Skip to content

Commit

Permalink
Merge pull request #135 from 195858/main
Browse files Browse the repository at this point in the history
Update to Event Portal 2.0.27 spec and removal of references to deprecated API elements
  • Loading branch information
TamimiGitHub committed Mar 19, 2024
2 parents 99a959b + 7cf44ae commit 971114b
Show file tree
Hide file tree
Showing 55 changed files with 45,683 additions and 351 deletions.
10 changes: 10 additions & 0 deletions .changeset/little-cups-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@solace-labs/ep-openapi-node": major
"@solace-labs/ep-async-api-importer": minor
"@solace-labs/ep-rt-openapi-node": minor
"@solace-labs/ep-asyncapi": minor
"@solace-labs/ep-migrate": minor
"@solace-labs/ep-sdk": minor
---

Open API clients to 2.0.27 and removes all references to deprecated APIs
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ yarn-error.log
_todo*
references
generated.openapi-spec.json
venv
venv
setup_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
EpAsyncApiDocument,
EpAsyncApiDocumentService,
EpAsyncApiMessageDocument,
E_EpAsyncApiContentTypes,
T_EpAsyncApiChannelDocumentMap
} from "@solace-labs/ep-asyncapi";
import {
Expand All @@ -36,7 +35,6 @@ import {
ECliRunSummary_Type,
ICliGenerateApiOutputRunContext,
CliUtils,
CliAsyncApiSpecFeatureNotSupportedError,
ICliApiRunContext,
CliRunExecuteReturnLog,
CliImporterTestRunAssetsInconsistencyError,
Expand Down Expand Up @@ -204,15 +202,6 @@ export class CliApplicationImporter extends CliAssetsImporter {
const epAsynApiChannelPublishOperation: EpAsynApiChannelPublishOperation | undefined = epAsyncApiChannelDocument.getEpAsyncApiChannelPublishOperation();
if (epAsynApiChannelPublishOperation !== undefined) {
const epAsyncApiMessageDocument: EpAsyncApiMessageDocument = epAsynApiChannelPublishOperation.getEpAsyncApiMessageDocument();
if(epAsyncApiMessageDocument.getContentType() !== E_EpAsyncApiContentTypes.APPLICATION_JSON)
/* istanbul ignore next */
throw new CliAsyncApiSpecFeatureNotSupportedError(logName, "unsupported message content type", {
messageName: epAsyncApiMessageDocument.getMessageName(),
contentType: epAsyncApiMessageDocument.getContentType(),
supportedContentTypes:
epAsyncApiDocument.getSupportedContentTypes(),
});

const schemaFilePath = schemasOutputDir + "/" + CliUtils.convertStringToFilePath(epAsyncApiMessageDocument.getSchemaFileName());
CliUtils.saveContents2File({
filePath: schemaFilePath,
Expand All @@ -222,14 +211,6 @@ export class CliApplicationImporter extends CliAssetsImporter {
const epAsyncApiChannelSubscribeOperation: EpAsyncApiChannelSubscribeOperation | undefined = epAsyncApiChannelDocument.getEpAsyncApiChannelSubscribeOperation();
if (epAsyncApiChannelSubscribeOperation !== undefined) {
const epAsyncApiMessageDocument: EpAsyncApiMessageDocument = epAsyncApiChannelSubscribeOperation.getEpAsyncApiMessageDocument();
if (epAsyncApiMessageDocument.getContentType() !== E_EpAsyncApiContentTypes.APPLICATION_JSON)
/* istanbul ignore next */
throw new CliAsyncApiSpecFeatureNotSupportedError(logName, "unsupported message content type", {
messageName: epAsyncApiMessageDocument.getMessageName(),
contentType: epAsyncApiMessageDocument.getContentType(),
supportedContentTypes:
epAsyncApiDocument.getSupportedContentTypes(),
});

const schemaFilePath = schemasOutputDir + "/" + CliUtils.convertStringToFilePath(epAsyncApiMessageDocument.getSchemaFileName());
CliUtils.saveContents2File({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ export abstract class CliAssetsImporter extends CliImporter {
applicationDomainId: schemaApplicationDomainId,
schemaName: epAsyncApiMessageDocument.getPayloadSchemaName(),
schemaObjectSettings: {
contentType: CliAsyncApiDocumentService.map_MessageDocumentContentType_To_EpSchemaContentType(epAsyncApiMessageDocument.getContentType()),
schemaType: CliAsyncApiDocumentService.map_MessageDocumentSchemaFormatType_To_EpSchemaFormatType(epAsyncApiMessageDocument.getSchemaFormatType()),
shared: epAsyncApiMessageDocument.getPayloadSchemaEpIsShared(this.cliImporterOptions.cliImport_DefaultSharedFlag),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
EpAsyncApiDocument,
EpAsyncApiDocumentService,
EpAsyncApiMessageDocument,
E_EpAsyncApiContentTypes,
T_EpAsyncApiChannelDocumentMap,
} from "@solace-labs/ep-asyncapi";
import {
Expand All @@ -25,7 +24,6 @@ import {
IEpSdkEventApiVersionTask_ExecuteReturn,
} from "@solace-labs/ep-sdk";
import {
CliAsyncApiSpecFeatureNotSupportedError,
CliEPApiContentError,
CliErrorFactory,
CliImporterTestRunAssetsInconsistencyError,
Expand Down Expand Up @@ -495,15 +493,6 @@ export class CliEventApiImporter extends CliAssetsImporter {
const epAsynApiChannelPublishOperation: EpAsynApiChannelPublishOperation | undefined = epAsyncApiChannelDocument.getEpAsyncApiChannelPublishOperation();
if (epAsynApiChannelPublishOperation !== undefined) {
const epAsyncApiMessageDocument: EpAsyncApiMessageDocument = epAsynApiChannelPublishOperation.getEpAsyncApiMessageDocument();
if(epAsyncApiMessageDocument.getContentType() !== E_EpAsyncApiContentTypes.APPLICATION_JSON)
/* istanbul ignore next */
throw new CliAsyncApiSpecFeatureNotSupportedError(logName, "unsupported message content type", {
messageName: epAsyncApiMessageDocument.getMessageName(),
contentType: epAsyncApiMessageDocument.getContentType(),
supportedContentTypes:
epAsyncApiDocument.getSupportedContentTypes(),
});

const schemaFilePath = schemasOutputDir + "/" + CliUtils.convertStringToFilePath(epAsyncApiMessageDocument.getSchemaFileName());
CliUtils.saveContents2File({
filePath: schemaFilePath,
Expand All @@ -513,15 +502,6 @@ export class CliEventApiImporter extends CliAssetsImporter {
const epAsyncApiChannelSubscribeOperation: EpAsyncApiChannelSubscribeOperation | undefined = epAsyncApiChannelDocument.getEpAsyncApiChannelSubscribeOperation();
if (epAsyncApiChannelSubscribeOperation !== undefined) {
const epAsyncApiMessageDocument: EpAsyncApiMessageDocument = epAsyncApiChannelSubscribeOperation.getEpAsyncApiMessageDocument();
if (epAsyncApiMessageDocument.getContentType() !== E_EpAsyncApiContentTypes.APPLICATION_JSON)
/* istanbul ignore next */
throw new CliAsyncApiSpecFeatureNotSupportedError(logName, "unsupported message content type", {
messageName: epAsyncApiMessageDocument.getMessageName(),
contentType: epAsyncApiMessageDocument.getContentType(),
supportedContentTypes:
epAsyncApiDocument.getSupportedContentTypes(),
});

const schemaFilePath = schemasOutputDir + "/" + CliUtils.convertStringToFilePath(epAsyncApiMessageDocument.getSchemaFileName());
CliUtils.saveContents2File({
filePath: schemaFilePath,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {
EEpSdkSchemaContentType,
EEpSdkSchemaType,
} from "@solace-labs/ep-sdk";
import {
EpAsyncApiDocument,
EpAsyncApiDocumentService,
E_EpAsyncApiContentTypes,
E_EpAsyncApiSchemaFormatType,
} from "@solace-labs/ep-asyncapi";

Expand Down Expand Up @@ -76,23 +74,6 @@ class CliAsyncApiDocumentService {
}
};

public map_MessageDocumentContentType_To_EpSchemaContentType(
messageContentType: E_EpAsyncApiContentTypes
): EEpSdkSchemaContentType {
const funcName = "map_MessageDocumentContentType_To_EpSchemaContentType";
const logName = `${CliAsyncApiDocumentService.name}.${funcName}()`;
switch (messageContentType) {
case E_EpAsyncApiContentTypes.APPLICATION_JSON:
return EEpSdkSchemaContentType.APPLICATION_JSON;
default:
CliUtils.assertNever(logName, messageContentType);
}
throw new CliInternalCodeInconsistencyError(logName, {
message: "map message content type",
messageContentType: messageContentType,
});
}

public map_MessageDocumentSchemaFormatType_To_EpSchemaFormatType(
messageSchemaFormatType: E_EpAsyncApiSchemaFormatType
): EEpSdkSchemaType {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
asyncapi: '2.4.0'
x-ep-application-domain-name: ep-asyncapi-importer/test/passing/acme-retail/AcmeRetail-Central-IT-Provider-TillSystem-v1-Test.spec
id: urn:com:acme-retail:central-it:provider:till-system:test
info:
title: Central-IT-Provider-TillSystem-v1-Test
version: '1.2.5'
x-ep-application-domain-name: TestNewAppDomain
x-ep-assets-application-domain-name: AssetTestNewAppDomain
title: AcmeRetail-Central-IT-Provider-TillSystem-v1-Test
version: '1.2.3'
description: |
Test for Provider Service API for the Central IT Till System.
Expand All @@ -17,49 +19,103 @@ defaultContentType: application/json

channels:

catalyst-labs/acme-retail/till-system/v1/{regionId_v1}/{storeId_v1}/receipt:
x-ep-event-name: Store Receipt
description: The topic to receive till receipts from stores on.
catalyst-labs/acme-retail/till-system/v1/{storeId}/receipt:
description: The topic to simulate sending till receipts from stores on.
parameters:
storeId_v1:
$ref: '#/components/parameters/storeId-v1'
regionId_v1:
$ref: '#/components/parameters/regionId-v1'
storeId:
$ref: '#/components/parameters/storeId'
subscribe:
summary: Receive till receipts from stores.
operationId: receiveStoreTillReceipts
summary: Simulate sending till receipts from stores.
operationId: sendStoreTillReceipts
message:
# x-parser-message-name: storeTillReceipt
$ref: '#/components/messages/storeTillReceipt-v1'

catalyst-labs/acme-retail/till-system/v1/{regionId_v1}/{storeId_v1}/error:
x-ep-event-name: Till System Error
description: The topic to send errors as response to a transaction on.
catalyst-labs/acme-retail/till-system/v1/{storeId}/error:
description: The topic to receive errors as response to a transaction on.
parameters:
storeId_v1:
$ref: '#/components/parameters/storeId-v1'
regionId_v1:
$ref: '#/components/parameters/regionId-v1'
storeId:
$ref: '#/components/parameters/storeId'
publish:
summary: Send errors to store for transaction.
operationId: sendStoreTillSystemError
summary: Receive errors to store for transaction.
operationId: receiveStoreTillSystemError
message:
# # x-parser-message-name: storeTillReceipt
# x-parser-message-name: storeTillReceipt
$ref: '#/components/messages/storeTillSystemError-v1'

components:
messages:
storeTillReceipt-v1:
name: storeTillReceipt-v1
title: Store Till Receipt
summary: Store Till Receipt.
contentType: application/json
# traits:
# - $ref: '#/components/messageTraits/commonHeaders'
payload:
$ref: "#/components/schemas/storeTillReceipt-v1"

storeTillSystemError-v1:
name: storeTillSystemError-v1
title: Till System Error for transaction.
contentType: application/json
payload:
$ref: "#/components/schemas/storeTillSystemError-v1"

schemas:
storeTillReceipt-v1:
$ref: "https://github.com/SolaceLabs/solace-tools-typescript/references/asyncapi-specs/acme-retail/messages/storeTillReceipt-v1.yml"
type: object
properties:
payload:
$ref: "#/components/schemas/storeTillReceiptPayload-v1"
header:
$ref: "https://github.com/solace-iot-team/solace-apim-reference-designs/main/use-cases/acme-retail/central-it/schemas/CommonHeader.v1.yml"
storeTillReceiptPayload-v1:
type: array
items:
$ref: '#/components/schemas/tillReceiptLine-v1'
tillReceiptLine-v1:
type: object
properties:
sku:
$ref: "https://github.com/solace-iot-team/solace-apim-reference-designs/main/use-cases/acme-retail/central-it/schemas/sku.v1.yml"
quantity:
$ref: "https://github.com/solace-iot-team/solace-apim-reference-designs/main/use-cases/acme-retail/central-it/schemas/quantity.v1.yml"
price:
$ref: "https://github.com/solace-iot-team/solace-apim-reference-designs/main/use-cases/acme-retail/central-it/schemas/price.v1.yml"
currency:
$ref: "https://github.com/solace-iot-team/solace-apim-reference-designs/main/use-cases/acme-retail/central-it/schemas/currency.v1.yml"
required:
- sku
- quantity
- price
- currency

storeTillSystemError-v1:
$ref: "https://github.com/SolaceLabs/solace-tools-typescript/references/asyncapi-specs/acme-retail/messages/storeTillSystemError-v1.yml"
type: object
properties:
payload:
$ref: "https://github.com/solace-iot-team/solace-apim-reference-designs/main/use-cases/acme-retail/central-it/schemas/storeTillSystemErrorPayload-v1.yml"
header:
$ref: "https://github.com/solace-iot-team/solace-apim-reference-designs/main/use-cases/acme-retail/central-it/schemas/CommonHeader.v1.yml"

# securitySchemes:
# saslScram:
# type: scramSha256
# description: Provide your username and password for SASL/SCRAM authentication

parameters:
storeId-v1:
storeId:
description: The ID of the store.
schema:
type: string
regionId-v1:
$ref: "https://github.com/SolaceLabs/solace-tools-typescript/references/asyncapi-specs/acme-retail/parameters/regionId.v1.yml"

# messageTraits:
# commonHeaders:
# headers:
# type: object
# properties:
# my-app-header:
# type: integer
# minimum: 0
# maximum: 100
Loading

0 comments on commit 971114b

Please sign in to comment.