Skip to content

Commit

Permalink
Merge pull request #50 from SolaceLabs/ep-apps6
Browse files Browse the repository at this point in the history
Ep apps6
  • Loading branch information
ricardojosegomezulmke authored Mar 13, 2023
2 parents 5631fd8 + d5cb94f commit fdc8a91
Show file tree
Hide file tree
Showing 97 changed files with 4,430 additions and 1,787 deletions.
34 changes: 34 additions & 0 deletions .changeset/ep-asyncapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
"@solace-labs/ep-asyncapi": minor
---

added ep extensions

- when parsing the document ep extensions are taken into consideration
- priority:
- existing extensions
- ep extensions

The following ep extensions are supported:

```typescript
/** extensions used by EP when exporting spec */
export enum EpParameterExtensions {
xEpEnumName = "x-ep-enum-name",
xEpEnumVersionDisplayName = "x-ep-enum-version-displayname",
}
/** extensions used by EP when exporting spec */
export enum EpMessageExtensions {
xEpEventName = "x-ep-event-name",
xEpEventVersionDisplayName = "x-ep-event-version-displayname",
}
/** extensions used by EP when exporting spec */
export enum EpSchemaExtensions {
xEpSchemaName = "x-ep-schema-name",
xEpSchemaVersionDisplayName = "x-ep-schema-version-displayname",
}
/** extensions used by EP when exporting spec */
export enum EpApiInfoExtensions {
xEpApiInfoVersionDisplayName = "x-ep-displayname",
}
```
14 changes: 14 additions & 0 deletions .changeset/ep-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@solace-labs/ep-sdk": minor
---

added support for XML

- new: `EEpSdkSchemaType.XSD`
- new: `EEpSdkSchemaContentType.APPLICATION_XML`

added source application domain id as attribute on copy

- objects: enums, schemas, events, event apis
- name: x-ep-sdk-source-application-domain-id
value: the source application domain id
22 changes: 22 additions & 0 deletions .changeset/importer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
"@solace-labs/ep-async-api-importer": minor
---

Added support for additional ep extensions

- see CHANGELOG.md for ep-asyncapi.

Added new CLI environment variable:

```bash
export CLI_IMPORT_CREATE_API_EVENT_API=true/false
```

if set to true, the importer will create the Event API.
if set to false, the import will not create the Event API.

Use in conjunction with:

```bash
export CLI_IMPORT_CREATE_API_APPLICATION=true/false
```
5 changes: 5 additions & 0 deletions .changeset/wet-bananas-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@internal/tools": minor
---

added integration test functionality
63 changes: 63 additions & 0 deletions docs/source/ep-async-api-importer/apis-content/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,66 @@ The importer uses the following extensions:

- Event Name = $.channel.{topic}
- Event Version Name = EMPTY


In addition, it uses the following Event Portal extensions:

.. list-table:: Event Portal Info Extensions
:widths: 30 100
:header-rows: 1

* - Async Api Extension
- Description
* - $.info.x-ep-displayname
- The version display name for Event APIs and Applications.

Defaults to empty string if omitted.


.. list-table:: Event Portal Message Extensions
:widths: 30 100
:header-rows: 1

* - Async Api Extension
- Description
* - x-ep-event-name
- The Event name for the message.

Defaults to `$.channels.{topic}.x-ep-event-name` if omitted.
* - x-ep-event-version-displayname
- The Event version name for the message.

Defaults to empty string if omitted.


.. list-table:: Event Portal Schema Extensions
:widths: 30 100
:header-rows: 1

* - Async Api Extension
- Description
* - x-ep-schema-name
- The Schema name for the schema.

Defaults to `x-ep-event-name` if omitted.
* - x-ep-schema-version-displayname
- The Schema version name for the schema.

Defaults to empty string if omitted.


.. list-table:: Event Portal Channel Parameter Extensions
:widths: 30 100
:header-rows: 1

* - Async Api Extension
- Description
* - x-ep-enum-name
- The Enum name for the parameter.

Defaults to the string in the channel parameter if omitted.
* - x-ep-enum-version-displayname
- The Enum version name for the parameter.

Defaults to empty string if omitted.

24 changes: 24 additions & 0 deletions docs/source/ep-async-api-importer/usage-content/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,27 @@ After each Api import the following output is generated:

- {schema-name}.json
- ...


Importing Api as Event API
--------------------------

The default mode is to import the Api as an Event API.

You can switch it off by setting the following environment variable:

.. code-block:: bash
export CLI_IMPORT_CREATE_API_EVENT_API=false
Importing Api as Application
----------------------------

By default, importing the Api as an Application is switched off.

You can switch it on by setting the following environment variable:

.. code-block:: bash
export CLI_IMPORT_CREATE_API_APPLICATION=true
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solace-labs/solace-tools-typescript",
"version": "2.9.5",
"version": "2.9.6",
"private": true,
"workspaces": [
"packages/*"
Expand All @@ -14,6 +14,7 @@
"build": "turbo run build && yarn typedoc && ./docs/make.sh",
"build:test": "turbo run build:test",
"test": "turbo run test",
"test:x": "turbo run test:x",
"dev:watch": "turbo run dev:watch",
"lint": "turbo run lint",
"lint:deprecated": "turbo run lint:deprecated",
Expand Down
1 change: 1 addition & 0 deletions packages/ep-async-api-importer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ dist
node_modules
_todo*
logs
tmp
output
1 change: 1 addition & 0 deletions packages/ep-async-api-importer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"clean": "rm -rf dist && rm -rf test/logs && rm -rf .turbo",
"build:test": "yarn build",
"test": "yarn build:test && . ./test/source.env.sh && nyc mocha --config test/.mocharc.yml test/**/**.spec.ts && unset_source_env",
"test:x": "yarn build:test && . ./test/source.env.sh && mocha --config test/.mocharc.yml test/**/**.x-spec.ts && unset_source_env",
"dev:watch": "yarn build --watch",
"lint": "eslint .",
"lint:deprecated": "yarn lint | grep deprecated",
Expand Down
15 changes: 12 additions & 3 deletions packages/ep-async-api-importer/src/cli-components/CliConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ enum ECliConfigEnvVarNames {
CLI_IMPORT_ASSETS_TARGET_VERSION_STRATEGY = "CLI_IMPORT_ASSETS_TARGET_VERSION_STRATEGY",
CLI_IMPORT_ASSETS_OUTPUT_DIR = "CLI_IMPORT_ASSETS_OUTPUT_DIR",
CLI_IMPORT_CREATE_API_APPLICATION = "CLI_IMPORT_CREATE_API_APPLICATION",
CLI_IMPORT_CREATE_API_EVENT_API = "CLI_IMPORT_CREATE_API_EVENT_API",
CLI_IMPORT_BROKER_TYPE = "CLI_IMPORT_BROKER_TYPE",
CLI_IMPORT_CHANNEL_DELIMITER = "CLI_IMPORT_CHANNEL_DELIMITER",
CLI_TEST_SETUP_DOMAINS_FOR_APIS = "CLI_TEST_SETUP_DOMAINS_FOR_APIS",
Expand All @@ -101,6 +102,7 @@ const DEFAULT_CLI_IMPORT_ASSETS_TARGET_LIFECYLE_STATE = ECliAssetImport_TargetLi
const DEFAULT_CLI_IMPORT_ASSETS_TARGET_VERSION_STRATEGY = ECliAssetImport_TargetVersionStrategy.BUMP_PATCH;
const DEFAULT_CLI_IMPORT_ASSET_OUTPUT_DIR = "./tmp/output";
const DEFAULT_CLI_IMPORT_CREATE_API_APPLICATION = false;
const DEFAULT_CLI_IMPORT_CREATE_API_EVENT_API = true;
const DEFAULT_CLI_TEST_SETUP_DOMAINS_FOR_APIS = false;
const DEFAULT_CLI_VALIDATE_API_BEST_PRACTICES = true;

Expand Down Expand Up @@ -217,12 +219,18 @@ const CliConfigEnvVarConfigList: Array<TCliConfigEnvVarConfig> = [
},
{
envVarName: ECliConfigEnvVarNames.CLI_IMPORT_CREATE_API_APPLICATION,
description:
"Flag to create also an application representing the Event API.",
description: "Flag to create an Event Portal Application representing the API Spec.",
required: false,
default: String(DEFAULT_CLI_IMPORT_CREATE_API_APPLICATION),
options: Object.values(ECliConfigBooleanOptions),
},
{
envVarName: ECliConfigEnvVarNames.CLI_IMPORT_CREATE_API_EVENT_API,
description: "Flag to create an Event Portal Event API representing the API Spec.",
required: false,
default: String(DEFAULT_CLI_IMPORT_CREATE_API_EVENT_API),
options: Object.values(ECliConfigBooleanOptions),
},
{
envVarName: ECliConfigEnvVarNames.CLI_IMPORT_BROKER_TYPE,
description: `The broker type setting for all imported objects. Overrides broker type specified in the spec, extension: ${E_EpAsyncApiExtensions.X_EP_BROKER_TYPE}`,
Expand Down Expand Up @@ -499,7 +507,8 @@ class CliConfig {
cliImporterManagerMode: this.getOptionalEnvVarValueAsString_From_Options_WithDefault(ECliConfigEnvVarNames.CLI_MODE, Object.values(ECliImporterManagerMode), DEFAULT_CLI_MODE) as ECliImporterManagerMode,
applicationDomainName: applicationDomainName,
assetApplicationDomainName: assetApplicationDomainName,
createEventApiApplication: this.getOptionalEnvVarValueAsBoolean_WithDefault(ECliConfigEnvVarNames.CLI_IMPORT_CREATE_API_APPLICATION, DEFAULT_CLI_IMPORT_CREATE_API_APPLICATION),
createApiApplication: this.getOptionalEnvVarValueAsBoolean_WithDefault(ECliConfigEnvVarNames.CLI_IMPORT_CREATE_API_APPLICATION, DEFAULT_CLI_IMPORT_CREATE_API_APPLICATION),
createApiEventApi: this.getOptionalEnvVarValueAsBoolean_WithDefault(ECliConfigEnvVarNames.CLI_IMPORT_CREATE_API_EVENT_API, DEFAULT_CLI_IMPORT_CREATE_API_EVENT_API),
cliTestSetupDomainsForApis: this.getOptionalEnvVarValueAsBoolean_WithDefault(ECliConfigEnvVarNames.CLI_TEST_SETUP_DOMAINS_FOR_APIS, DEFAULT_CLI_TEST_SETUP_DOMAINS_FOR_APIS),
cliImporterOptions: {
runId: runId,
Expand Down
Loading

0 comments on commit fdc8a91

Please sign in to comment.