diff --git a/src/helpers/DiffHelpers.ts b/src/helpers/DiffHelpers.ts index c195345..48040d9 100644 --- a/src/helpers/DiffHelpers.ts +++ b/src/helpers/DiffHelpers.ts @@ -102,7 +102,7 @@ export function formatDiffOutput( export function getDocumentMajorVersion(document: any): string { const asyncapiVersion: string = document.asyncapi; - return asyncapiVersion.split('.').at(0) as string; + return asyncapiVersion.split('.')[0] as string; } export function incompatibleDocuments( diff --git a/src/main.ts b/src/main.ts index f0595c2..410b638 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,7 @@ import { getStandardFromVersion } from './standard'; import categorizeChanges from './categorizeChanges'; import AsyncAPIDiff from './asyncapidiff'; import { mergeStandard } from './mergeStandard'; -import { incompatibleDocuments } from 'helpers/DiffHelpers'; +import { incompatibleDocuments } from './helpers/DiffHelpers'; /** * Generates diff between two AsyncAPI documents diff --git a/src/standard.ts b/src/standard.ts index 8f7a2ff..f052f32 100644 --- a/src/standard.ts +++ b/src/standard.ts @@ -1,4 +1,4 @@ -import { getDocumentMajorVersion } from 'helpers/DiffHelpers'; +import { getDocumentMajorVersion } from './helpers/DiffHelpers'; import { standard as v2Standard } from './standards/v2'; import { standard as v3Standard } from './standards/v3'; import { StandardType } from 'types'; diff --git a/src/standards/v3.ts b/src/standards/v3.ts index ba1d155..09a36c8 100644 --- a/src/standards/v3.ts +++ b/src/standards/v3.ts @@ -21,18 +21,586 @@ export const standard = { remove: breaking, edit: nonBreaking, }, - '/info/title': {}, - '/info/version': {}, - '/info/description': {}, - '/info/termsOfService': {}, - '/info/contact': {}, - '/info/license': {}, - '/info/tags': {}, - '/info/externalDocs': {}, - '/servers': {}, - '/defaultContentType': {}, - '/channels': {}, - '/operations': {}, + '/info/title': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/info/version': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/info/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/info/termsOfService': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/info/contact': { + add: nonBreaking, + remove: breaking, + edit: nonBreaking, + }, + '/info/contact/name': { + add: nonBreaking, + remove: breaking, + edit: nonBreaking, + }, + '/info/contact/url': { + add: nonBreaking, + remove: breaking, + edit: nonBreaking, + }, + '/info/contact/email': { + add: nonBreaking, + remove: breaking, + edit: nonBreaking, + }, + '/info/license': { + add: nonBreaking, + remove: breaking, + edit: nonBreaking, + }, + '/info/license/name': { + add: nonBreaking, + remove: breaking, + edit: nonBreaking, + }, + '/info/license/url': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/info/tags': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/info/tags/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/info/externalDocs': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/host': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/protocol': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/protocolVersion': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/pathname': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/title': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/variables': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/variables/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/variables/*/enum': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/variables/*/enum/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/variables/*/default': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/variables/*/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/variables/*/examples': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/variables/*/examples/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/security': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/security/*': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/servers/*/tags': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/tags/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/externalDocs': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/servers/*/bindings': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/defaultContentType': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/channels': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/address': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/headers': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/payload': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/correlationId': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/contentType': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/name': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/title': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/summary': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/tags': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/tags/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/externalDocs': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/bindings': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/channels/*/messages/*/examples': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/examples/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/traits/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/traits/*/headers': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/channels/*/messages/*/traits/*/correlationId': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/traits/*/correlationId/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/correlationId/location': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/traits/*/contentType': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/messages/*/traits/*/name': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/title': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/summary': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/tags': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/tags/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/externalDocs': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/bindings': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/channels/*/messages/*/traits/*/examples': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/messages/*/traits/*/examples/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/title': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/summary': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/servers': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/servers/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/parameters': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/channels/*/tags': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/tags/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/externalDocs': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/channels/*/bindings': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/operations': { + add: nonBreaking, + remove: breaking, + edit: nonBreaking, + }, + '/operations/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/action': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/channel': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/title': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/summary': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/security': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/security/*': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/tags': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/tags/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/externalDocs': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/bindings': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/operations/*/traits': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/traits/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/traits/*/title': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/traits/*/summary': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/traits/*/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/traits/*/security': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/traits/*/security/*': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/traits/*/tags': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/traits/*/tags/*': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/traits/*/externalDocs': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/traits/*/bindings': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/operations/*/messages': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/messages/*': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/reply': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/reply/address': { + add: breaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/reply/address/description': { + add: nonBreaking, + remove: nonBreaking, + edit: nonBreaking, + }, + '/operations/*/reply/address/location': { + add: nonBreaking, + remove: breaking, + edit: breaking, + }, + '/operations/*/reply/channel': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/operations/*/reply/messages': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, + '/operations/*/reply/messages/*': { + add: unclassified, + remove: unclassified, + edit: unclassified, + }, '/components': { add: nonBreaking, remove: nonBreaking,