Skip to content

Commit

Permalink
fix: AsyncAPI v3 shows warning in Studio and IntelliJ plugin when ref…
Browse files Browse the repository at this point in the history
…erencing a json schema

New multiFormatSchema validation rules

asyncapi#494
asyncapi/jasyncapi-idea-plugin#49
  • Loading branch information
Pakisan committed Mar 22, 2024
1 parent 297e778 commit dddb3d3
Show file tree
Hide file tree
Showing 4 changed files with 999 additions and 1,218 deletions.
138 changes: 127 additions & 11 deletions definitions/3.0.0/anySchema.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,132 @@
{
"if": {
"required": [
"schema"
]
},
"then": {
"$ref": "http://asyncapi.com/definitions/3.0.0/multiFormatSchema.json"
},
"else": {
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
},
"description": "An object representing either a schema or a multiFormatSchema based on the existence of the 'schema' property. If the property 'schema' is present, use the multi-format schema. Use the default AsyncAPI Schema otherwise.",
"type": "object",
"anyOf": [
{
"type": "object",
"description": "AsyncAPI Schema",
"not": {
"required": ["schemaFormat", "schema"]
},
"additionalProperties": false,
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
},
{
"type": "object",
"description": "Multi format schema: Avro Schema",
"required": ["schemaFormat", "schema"],
"not": {"required": ["$ref"]},
"additionalProperties": false,
"properties": {
"schemaFormat": {
"type": "string",
"enum": [
"application/vnd.apache.avro;version=1.9.0",
"application/vnd.apache.avro+json;version=1.9.0",
"application/vnd.apache.avro+yaml;version=1.9.0"
]
},
"schema": {
"if": {
"not": {"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"}
},
"then": {
"$ref": "http://asyncapi.com/definitions/3.0.0/avroSchema_v1.json"
},
"else": {
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
}
}
}
},
{
"type": "object",
"description": "Multi format schema: OpenAPI Schema",
"required": ["schemaFormat", "schema"],
"not": {"required": ["$ref"]},
"additionalProperties": false,
"properties": {
"schemaFormat": {
"type": "string",
"enum": [
"application/vnd.oai.openapi;version=3.0.0",
"application/vnd.oai.openapi+json;version=3.0.0",
"application/vnd.oai.openapi+yaml;version=3.0.0"
]
},
"schema": {
"anyOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/openapiSchema_3_0.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
}
]
}
}
},
{
"type": "object",
"description": "Multi format schema: Json Schema",
"required": ["schemaFormat", "schema"],
"not": {"required": ["$ref"]},
"additionalProperties": false,
"properties": {
"schemaFormat": {
"type": "string",
"enum": [
"application/schema+json;version=draft-07",
"application/schema+yaml;version=draft-07"
]
},
"schema": {
"$ref": "http://json-schema.org/draft-07/schema"
}
}
},
{
"type": "object",
"description": "Multi format schema: AsyncAPI Schema",
"required": ["schemaFormat", "schema"],
"not": {"required": ["$ref"]},
"additionalProperties": false,
"properties": {
"schemaFormat": {
"type": "string",
"enum": [
"application/vnd.aai.asyncapi;version=2.0.0",
"application/vnd.aai.asyncapi+json;version=2.0.0",
"application/vnd.aai.asyncapi+yaml;version=2.0.0",
"application/vnd.aai.asyncapi;version=2.1.0",
"application/vnd.aai.asyncapi+json;version=2.1.0",
"application/vnd.aai.asyncapi+yaml;version=2.1.0",
"application/vnd.aai.asyncapi;version=2.2.0",
"application/vnd.aai.asyncapi+json;version=2.2.0",
"application/vnd.aai.asyncapi+yaml;version=2.2.0",
"application/vnd.aai.asyncapi;version=2.3.0",
"application/vnd.aai.asyncapi+json;version=2.3.0",
"application/vnd.aai.asyncapi+yaml;version=2.3.0",
"application/vnd.aai.asyncapi;version=2.4.0",
"application/vnd.aai.asyncapi+json;version=2.4.0",
"application/vnd.aai.asyncapi+yaml;version=2.4.0",
"application/vnd.aai.asyncapi;version=2.5.0",
"application/vnd.aai.asyncapi+json;version=2.5.0",
"application/vnd.aai.asyncapi+yaml;version=2.5.0",
"application/vnd.aai.asyncapi;version=2.6.0",
"application/vnd.aai.asyncapi+json;version=2.6.0",
"application/vnd.aai.asyncapi+yaml;version=2.6.0",
"application/vnd.aai.asyncapi;version=3.0.0",
"application/vnd.aai.asyncapi+json;version=3.0.0",
"application/vnd.aai.asyncapi+yaml;version=3.0.0"
]
},
"schema": {
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
}
}
}
],
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/anySchema.json"
}
194 changes: 0 additions & 194 deletions definitions/3.0.0/multiFormatSchema.json

This file was deleted.

Loading

0 comments on commit dddb3d3

Please sign in to comment.