Skip to content

Commit

Permalink
style: perform schema formatting with the new JSON Schema CLI
Browse files Browse the repository at this point in the history
Hey there from a JSON Schema TSC and ex-Postman! We are developing an
open-source CLI (https://github.com/intelligence-ai/jsonschema)
specifically targeted at helping maintain repositories of schemas, just
like this one. The idea is to make it super smooth to work with schemas.

The tool is already capable of doing formatting, linting (which revals a
couple of issues already in this repo), testing, bundling, and more,
which can replace a few of the tools and scripts you already have here.

Instead of sending a big PR, here is a small one just making use of
formatting. The formatting implementation will re-organize keywords in a
schema to make them easier to read. For example, bumping `$schema` to
the top, ensuring consistent, indentation, etc.

If you like it, I'd love to continue working together to integrate more
things, like the linter, the schema test framework, etc.

Let me know what you think and if you have any requirement or idea,
please let me know and we'll happily implement it for you! We want to
make it super smooth to maintain repos like this one, so any feedback is
very welcomed!

Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Jun 12, 2024
1 parent d83cc02 commit 0cb40eb
Show file tree
Hide file tree
Showing 58 changed files with 1,622 additions and 1,430 deletions.
28 changes: 14 additions & 14 deletions definitions/3.0.0/APIKeyHTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/APIKeyHTTPSecurityScheme.json",
"type": "object",
"required": [
"type",
"name",
"in"
],
"properties": {
"description": {
"description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation.",
"type": "string"
},
"type": {
"type": "string",
"description": "The type of the security scheme.",
"type": "string",
"enum": [
"httpApiKey"
]
},
"name": {
"type": "string",
"description": "The name of the header, query or cookie parameter to be used."
},
"in": {
"type": "string",
"description": "The location of the API key",
"type": "string",
"enum": [
"header",
"query",
"cookie"
]
},
"description": {
"type": "string",
"description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation."
"name": {
"description": "The name of the header, query or cookie parameter to be used.",
"type": "string"
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"additionalProperties": false,
"example": {
"$ref": "http://asyncapi.com/examples/3.0.0/APIKeyHTTPSecurityScheme.json"
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/APIKeyHTTPSecurityScheme.json"
}
}
}
32 changes: 16 additions & 16 deletions definitions/3.0.0/BearerHTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/BearerHTTPSecurityScheme.json",
"type": "object",
"required": [
"type",
"scheme"
],
"properties": {
"scheme": {
"description": {
"description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation.",
"type": "string"
},
"type": {
"description": "The type of the security scheme.",
"type": "string",
"description": "The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235.",
"enum": [
"bearer"
"http"
]
},
"bearerFormat": {
"type": "string",
"description": "A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes."
"description": "A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.",
"type": "string"
},
"type": {
"scheme": {
"description": "The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235.",
"type": "string",
"description": "The type of the security scheme.",
"enum": [
"http"
"bearer"
]
},
"description": {
"type": "string",
"description": "A short description for security scheme. CommonMark syntax MAY be used for rich text representation."
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/BearerHTTPSecurityScheme.json"
}
"additionalProperties": false
}
8 changes: 4 additions & 4 deletions definitions/3.0.0/HTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/HTTPSecurityScheme.json",
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/NonBearerHTTPSecurityScheme.json"
Expand All @@ -9,7 +11,5 @@
{
"$ref": "http://asyncapi.com/definitions/3.0.0/APIKeyHTTPSecurityScheme.json"
}
],
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/HTTPSecurityScheme.json"
}
]
}
26 changes: 13 additions & 13 deletions definitions/3.0.0/NonBearerHTTPSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/NonBearerHTTPSecurityScheme.json",
"type": "object",
"not": {
"type": "object",
"properties": {
"scheme": {
"type": "string",
"description": "A short description for security scheme.",
"type": "string",
"enum": [
"bearer"
]
}
}
},
"type": "object",
"required": [
"scheme",
"type"
],
"properties": {
"scheme": {
"type": "string",
"description": "The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235."
},
"description": {
"type": "string",
"description": "A short description for security scheme."
"description": "A short description for security scheme.",
"type": "string"
},
"type": {
"type": "string",
"description": "The type of the security scheme.",
"type": "string",
"enum": [
"http"
]
},
"scheme": {
"description": "The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235.",
"type": "string"
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/NonBearerHTTPSecurityScheme.json"
}
"additionalProperties": false
}
10 changes: 5 additions & 5 deletions definitions/3.0.0/Reference.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/Reference.json",
"description": "A simple object to allow referencing other components in the specification, internally and externally.",
"type": "object",
"required": [
"$ref"
],
Expand All @@ -12,7 +14,5 @@
},
"example": {
"$ref": "http://asyncapi.com/examples/3.0.0/ReferenceObject.json"
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/Reference.json"
}
}
}
8 changes: 4 additions & 4 deletions definitions/3.0.0/ReferenceObject.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "string",
"format": "uri-reference",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/ReferenceObject.json"
}
"$id": "http://asyncapi.com/definitions/3.0.0/ReferenceObject.json",
"type": "string",
"format": "uri-reference"
}
22 changes: 11 additions & 11 deletions definitions/3.0.0/SaslGssapiSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslGssapiSecurityScheme.json",
"type": "object",
"required": [
"type"
],
"properties": {
"description": {
"description": "A short description for security scheme.",
"type": "string"
},
"type": {
"type": "string",
"description": "The type of the security scheme.",
"type": "string",
"enum": [
"gssapi"
]
},
"description": {
"type": "string",
"description": "A short description for security scheme."
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"example": {
"$ref": "http://asyncapi.com/examples/3.0.0/Sasl.json"
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslGssapiSecurityScheme.json"
}
"example": {
"$ref": "http://asyncapi.com/examples/3.0.0/Sasl.json"
}
}
18 changes: 9 additions & 9 deletions definitions/3.0.0/SaslPlainSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslPlainSecurityScheme.json",
"type": "object",
"required": [
"type"
],
"properties": {
"description": {
"description": "A short description for security scheme.",
"type": "string"
},
"type": {
"type": "string",
"description": "The type of the security scheme. Valid values",
"type": "string",
"enum": [
"plain"
]
},
"description": {
"type": "string",
"description": "A short description for security scheme."
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"additionalProperties": false,
"example": {
"$ref": "http://asyncapi.com/examples/3.0.0/Sasl.json"
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslPlainSecurityScheme.json"
}
}
18 changes: 9 additions & 9 deletions definitions/3.0.0/SaslScramSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslScramSecurityScheme.json",
"type": "object",
"required": [
"type"
],
"properties": {
"description": {
"description": "A short description for security scheme.",
"type": "string"
},
"type": {
"type": "string",
"description": "The type of the security scheme.",
"type": "string",
"enum": [
"scramSha256",
"scramSha512"
]
},
"description": {
"type": "string",
"description": "A short description for security scheme."
}
},
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"additionalProperties": false,
"example": {
"$ref": "http://asyncapi.com/examples/3.0.0/Sasl.json"
},
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslScramSecurityScheme.json"
}
}
8 changes: 4 additions & 4 deletions definitions/3.0.0/SaslSecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslSecurityScheme.json",
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/SaslPlainSecurityScheme.json"
Expand All @@ -9,7 +11,5 @@
{
"$ref": "http://asyncapi.com/definitions/3.0.0/SaslGssapiSecurityScheme.json"
}
],
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SaslSecurityScheme.json"
}
]
}
8 changes: 4 additions & 4 deletions definitions/3.0.0/SecurityScheme.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SecurityScheme.json",
"description": "Defines a security scheme that can be used by the operations.",
"oneOf": [
{
Expand Down Expand Up @@ -31,7 +33,5 @@
],
"example": {
"$ref": "http://asyncapi.com/examples/3.0.0/SecurityScheme.json"
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/definitions/3.0.0/SecurityScheme.json"
}
}
}
Loading

0 comments on commit 0cb40eb

Please sign in to comment.