Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02
core https://github.com/sourcemeta/core d18c4cfc0cebf9e29562acc442fce78f8677b2d5
blaze https://github.com/sourcemeta/blaze 2c5efbd14f5f24dbe3860be8c8d80279edc20d10
core https://github.com/sourcemeta/core fbdf367f3b443dd05fdbe7bae6685f86c8332e4f
blaze https://github.com/sourcemeta/blaze ad08d100148b60b03ee5f30c40f8f11ea9a13aca
ctrf https://github.com/ctrf-io/ctrf 93ea827d951390190171d37443bff169cf47c808
5 changes: 5 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,11 @@ add_jsonschema_test(bundle/pass_openapi_format)
add_jsonschema_test(bundle/pass_resolve_yaml_from_json)
add_jsonschema_test(bundle/pass_resolve_json_from_yaml)
add_jsonschema_test(bundle/pass_openapi_configuration_resolve)
add_jsonschema_test(bundle/pass_openapi_external_docs_resolve)
add_jsonschema_test(bundle/pass_openapi_external_docs_nested_id)
add_jsonschema_test(bundle/pass_openapi_external_docs_document_base)
add_jsonschema_test(bundle/pass_openapi_external_docs_absolute)
add_jsonschema_test(bundle/pass_openapi_external_docs_other_dialect)
add_jsonschema_test(bundle/fail_openapi_self_position)
add_jsonschema_test(bundle/fail_openapi_version_stdin)
add_jsonschema_test(bundle/fail_default_dialect_config_extension_mismatch)
Expand Down
42 changes: 42 additions & 0 deletions test/bundle/pass_openapi_external_docs_absolute.clitest
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
WRITE openapi.json UNTIL EOF
{
"openapi": "3.1.1",
"info": { "title": "Example", "version": "1.0.0" },
"paths": {},
"components": {
"schemas": {
"pet": {
"$id": "https://example.com/schemas/pet",
"externalDocs": { "url": "https://docs.example.com/pet.html" },
"type": "object"
}
}
}
}
EOF

RUN bundle openapi.json STDIN /dev/null IN . INTO result.txt EXPECTING 0

WRITE expected.txt UNTIL EOF
1> {
1> "openapi": "3.1.1",
1> "info": {
1> "title": "Example",
1> "version": "1.0.0"
1> },
1> "paths": {},
1> "components": {
1> "schemas": {
1> "pet": {
1> "$id": "https://example.com/schemas/pet",
1> "externalDocs": {
1> "url": "https://docs.example.com/pet.html"
1> },
1> "type": "object"
1> }
1> }
1> }
1> }
EOF

COMPARE result.txt AGAINST expected.txt
42 changes: 42 additions & 0 deletions test/bundle/pass_openapi_external_docs_document_base.clitest
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
WRITE openapi.json UNTIL EOF
{
"openapi": "3.2.0",
"$self": "https://example.com/openapi",
"info": { "title": "Example", "version": "1.0.0" },
"paths": {},
"components": {
"schemas": {
"pet": {
"externalDocs": { "url": "docs/pet.html" },
"type": "object"
}
}
}
}
EOF

RUN bundle openapi.json STDIN /dev/null IN . INTO result.txt EXPECTING 0

WRITE expected.txt UNTIL EOF
1> {
1> "openapi": "3.2.0",
1> "$self": "https://example.com/openapi",
1> "info": {
1> "title": "Example",
1> "version": "1.0.0"
1> },
1> "paths": {},
1> "components": {
1> "schemas": {
1> "pet": {
1> "externalDocs": {
1> "url": "https://example.com/docs/pet.html"
1> },
1> "type": "object"
1> }
1> }
1> }
1> }
EOF

COMPARE result.txt AGAINST expected.txt
52 changes: 52 additions & 0 deletions test/bundle/pass_openapi_external_docs_nested_id.clitest
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
WRITE openapi.json UNTIL EOF
{
"openapi": "3.1.1",
"info": { "title": "Example", "version": "1.0.0" },
"paths": {},
"components": {
"schemas": {
"pet": {
"$id": "https://example.com/schemas/pet",
"type": "object",
"properties": {
"collar": {
"$id": "https://example.com/other/collar",
"externalDocs": { "url": "collar.html" }
}
}
}
}
}
}
EOF

RUN bundle openapi.json STDIN /dev/null IN . INTO result.txt EXPECTING 0

WRITE expected.txt UNTIL EOF
1> {
1> "openapi": "3.1.1",
1> "info": {
1> "title": "Example",
1> "version": "1.0.0"
1> },
1> "paths": {},
1> "components": {
1> "schemas": {
1> "pet": {
1> "$id": "https://example.com/schemas/pet",
1> "type": "object",
1> "properties": {
1> "collar": {
1> "$id": "https://example.com/other/collar",
1> "externalDocs": {
1> "url": "https://example.com/other/collar.html"
1> }
1> }
1> }
1> }
1> }
1> }
1> }
EOF

COMPARE result.txt AGAINST expected.txt
44 changes: 44 additions & 0 deletions test/bundle/pass_openapi_external_docs_other_dialect.clitest
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
WRITE openapi.json UNTIL EOF
{
"openapi": "3.1.1",
"info": { "title": "Example", "version": "1.0.0" },
"paths": {},
"components": {
"schemas": {
"pet": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schemas/pet",
"externalDocs": { "url": "./docs/pet.html" },
"type": "object"
}
}
}
}
EOF

RUN bundle openapi.json STDIN /dev/null IN . INTO result.txt EXPECTING 0

WRITE expected.txt UNTIL EOF
1> {
1> "openapi": "3.1.1",
1> "info": {
1> "title": "Example",
1> "version": "1.0.0"
1> },
1> "paths": {},
1> "components": {
1> "schemas": {
1> "pet": {
1> "$schema": "https://json-schema.org/draft/2020-12/schema",
1> "$id": "https://example.com/schemas/pet",
1> "externalDocs": {
1> "url": "./docs/pet.html"
1> },
1> "type": "object"
1> }
1> }
1> }
1> }
EOF

COMPARE result.txt AGAINST expected.txt
89 changes: 89 additions & 0 deletions test/bundle/pass_openapi_external_docs_resolve.clitest
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
WRITE openapi.json UNTIL EOF
{
"openapi": "3.1.1",
"info": { "title": "Example", "version": "1.0.0" },
"paths": {
"/pets": {
"get": {
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": { "$ref": "https://example.com/schemas/pet" }
}
}
}
}
}
}
}
}
EOF

WRITE pet.json UNTIL EOF
{
"$id": "https://example.com/schemas/pet",
"$schema": "https://spec.openapis.org/oas/3.1/dialect/base",
"externalDocs": { "url": "./docs/pet.html" },
"type": "object",
"properties": {
"name": {
"externalDocs": { "url": "docs/name.html" },
"type": "string"
}
}
}
EOF

RUN bundle openapi.json --resolve pet.json STDIN /dev/null IN . INTO result.txt EXPECTING 0

WRITE expected.txt UNTIL EOF
1> {
1> "openapi": "3.1.1",
1> "info": {
1> "title": "Example",
1> "version": "1.0.0"
1> },
1> "paths": {
1> "/pets": {
1> "get": {
1> "responses": {
1> "200": {
1> "description": "OK",
1> "content": {
1> "application/json": {
1> "schema": {
1> "$ref": "https://example.com/schemas/pet"
1> }
1> }
1> }
1> }
1> }
1> }
1> }
1> },
1> "components": {
1> "schemas": {
1> "pet": {
1> "$schema": "https://spec.openapis.org/oas/3.1/dialect/base",
1> "$id": "https://example.com/schemas/pet",
1> "externalDocs": {
1> "url": "https://example.com/schemas/docs/pet.html"
1> },
1> "type": "object",
1> "properties": {
1> "name": {
1> "externalDocs": {
1> "url": "https://example.com/schemas/docs/name.html"
1> },
1> "type": "string"
1> }
1> }
1> }
1> }
1> }
1> }
EOF

COMPARE result.txt AGAINST expected.txt
2 changes: 1 addition & 1 deletion vendor/blaze/DEPENDENCIES

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions vendor/blaze/src/compiler/compile.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading