Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asyncapi/specs

Package Overview
Dependencies
Maintainers
3
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asyncapi/specs - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

6

package.json
{
"name": "@asyncapi/specs",
"version": "5.0.0",
"version": "5.0.1",
"description": "AsyncAPI schema versions",

@@ -40,2 +40,3 @@ "main": "index.js",

"devDependencies": {
"conventional-changelog-conventionalcommits": "^5.0.0",
"mocha": "^10.0.0",

@@ -45,5 +46,4 @@ "nyc": "^15.1.0"

"dependencies": {
"@types/json-schema": "^7.0.11",
"conventional-changelog-conventionalcommits": "^5.0.0"
"@types/json-schema": "^7.0.11"
}
}

@@ -128,5 +128,5 @@ ![npm](https://img.shields.io/npm/v/@asyncapi/specs?style=for-the-badge) ![npm](https://img.shields.io/npm/dt/@asyncapi/specs?style=for-the-badge)

### Creating a new version
## Creating a new version
## 1a Automated:
### 1a Automated:

@@ -139,3 +139,3 @@ ```bash

## 1a Manual
### 1a Manual

@@ -147,3 +147,3 @@ The manual process of creating a new version is to:

## 2 Further steps
### 2 Further steps

@@ -179,5 +179,22 @@ 1. Edit the [index.js](./index.js) file adding a new line with the new version. I.e.:

### Handling breaking changes
## Handling breaking changes
Whenever a Breaking Change is introduced, the following steps should be taken in Go package:
1. Edit `go.mod` file, and increase the version package suffix in the module name. For example, if the current version is `v2.0.0`, and you are releasing `v3.0.0`, the module name should be `github.com/asyncapi/spec-json-schemas/v3`.
## SchemaStore compatibility testing
AsyncAPI JSON Schema is referenced in [SchemaStore](https://www.schemastore.org/json/). In many IDEs, like VSCode, some extensions integrate with SchemaStore, like [YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml). This way we enable autocompletion, validation and tooltips that helps writing AsyncAPI documents.
Whenever you make changes in AsyncAPI JSON Schema, you should always manually verify that the schema is still supported by [YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) and that it will be able to fetch and dereference it.
- Make sure you have VSCode and YAML extension
- Once you make changes in schemas, bundle them with `npm run bundle`
- Edit [this sample AsyncAPI document](./test/fixtures/asyncapi.yml). Add a new field, hover over some property to see if tooltip still shows up. This sample document contains the following line that assures YAML uses your local schema and not the one from SchemaStore. Make sure it points to the schema bundle that you generated and that contains your changes:
```yaml
# yaml-language-server: $schema=YOUR-PROJECTS-DIRECTORY/spec-json-schemas/schemas/2.6.0-without-$id.json
```

@@ -58,3 +58,2 @@ const path = require('path');

/**

@@ -76,2 +75,5 @@ * we first update definitions from URL to normal names

traverse(bundledSchema, replaceRef);
traverse(bundledSchema.definitions.avroSchema_v1, updateAvro);
traverse(bundledSchema.definitions.openapiSchema_3_0, updateOpenApi);
traverse(bundledSchema.definitions['json-schema-draft-07-schema'], updateJsonSchema);

@@ -104,12 +106,55 @@ return bundledSchema

// '#/definitions' refs are always those related to JSON Schema draft, so we just need to update them to point to json schema draft that is inlined inside schema
if (schema.$ref.startsWith('#/definitions')) {
schema.$ref = schema.$ref.replace('#/definitions/', `#/definitions/${JSON_SCHEMA_PROP_NAME}/definitions/`);
// '#' refs need to be updated to point to the root of inlined json schema draft
} else if (schema.$ref === '#') {
// updating refs that are related to remote URL refs that need to be update and point to inlined versions
if (!schema.$ref.startsWith('#')) schema.$ref = `#/definitions/${getDefinitionName(schema.$ref)}`;
}
/**
* this is a callback used when traversing through json schema
* to fix avro schema definitions to point to right direction
*/
function updateAvro(schema){
//traversing shoudl take place only in case of schemas with refs
if (schema.$ref === undefined) return;
schema.$ref = schema.$ref.replace(
'#/definitions/',
'#/definitions/avroSchema_v1/definitions/'
);
}
/**
* this is a callback used when traversing through json schema
* to fix open api schema definitions to point to right direction
*/
function updateOpenApi(schema){
//traversing shoudl take place only in case of schemas with refs
if (schema.$ref === undefined) return;
const openApiPropName = 'openapiSchema_3_0';
schema.$ref = schema.$ref.replace(
'#/definitions/',
`#/definitions/${openApiPropName}/definitions/`
);
if (schema.$ref === '#') {
schema.$ref = `#/definitions/${openApiPropName}`;
}
}
/**
* this is a callback used when traversing through json schema
* to fix open api schema definitions to point to right direction
*/
function updateJsonSchema(schema){
//traversing shoudl take place only in case of schemas with refs
if (schema.$ref === undefined) return;
schema.$ref = schema.$ref.replace(
'#/definitions/',
`#/definitions/${JSON_SCHEMA_PROP_NAME}/definitions/`
);
if (schema.$ref === '#') {
schema.$ref = `#/definitions/${JSON_SCHEMA_PROP_NAME}`;
// the rest of refs are those related to remote URL refst that need to be update and point to inlined versions
} else {
schema.$ref = `#/definitions/${getDefinitionName(schema.$ref)}`;
}
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc