Support bundling OpenAPI descriptions in the bundle command - #891
Conversation
There was a problem hiding this comment.
1 issue found across 32 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="test/bundle/pass_openapi_mixed_resolve.clitest">
<violation number="1" location="test/bundle/pass_openapi_mixed_resolve.clitest:58">
P3: This test only asserts stdout (INTO result.txt + COMPARE) and discards the stderr stream of `bundle`. Any diagnostic noise or regression on stderr would pass unnoticed. Run the command with `--verbose` and assert the stderr stream is empty (or contains only expected content) using the harness's multi-stream assertion, as done in `pass_resolve_default_dialect_config.clitest` which already invokes `bundle ... --verbose`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| } | ||
| EOF | ||
|
|
||
| RUN bundle entry.json --resolve shared.json --resolve withid.json --resolve noid.json STDIN /dev/null IN . INTO result.txt EXPECTING 0 |
There was a problem hiding this comment.
P3: This test only asserts stdout (INTO result.txt + COMPARE) and discards the stderr stream of bundle. Any diagnostic noise or regression on stderr would pass unnoticed. Run the command with --verbose and assert the stderr stream is empty (or contains only expected content) using the harness's multi-stream assertion, as done in pass_resolve_default_dialect_config.clitest which already invokes bundle ... --verbose.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At test/bundle/pass_openapi_mixed_resolve.clitest, line 58:
<comment>This test only asserts stdout (INTO result.txt + COMPARE) and discards the stderr stream of `bundle`. Any diagnostic noise or regression on stderr would pass unnoticed. Run the command with `--verbose` and assert the stderr stream is empty (or contains only expected content) using the harness's multi-stream assertion, as done in `pass_resolve_default_dialect_config.clitest` which already invokes `bundle ... --verbose`.</comment>
<file context>
@@ -0,0 +1,111 @@
+}
+EOF
+
+RUN bundle entry.json --resolve shared.json --resolve withid.json --resolve noid.json STDIN /dev/null IN . INTO result.txt EXPECTING 0
+
+WRITE expected.txt UNTIL EOF
</file context>
🤖 Augment PR SummarySummary: This PR adds OpenAPI Description support to the
🤖 Was this summary useful? React with 👍 or 👎 |
| // goes to the resolver above rather than being reported from here | ||
| auto openapi(std::string_view identifier) | ||
| -> sourcemeta::core::OpenAPIResolverResult { | ||
| const std::string target{canonical_resolve_key(identifier)}; |
There was a problem hiding this comment.
openapi() bypasses the configured resolve map: unlike operator(), it canonicalizes the requested URI and fetches it directly. An OpenAPI $ref mapped to a local description in jsonschema.json is therefore ignored (or tries the network), even though resolver mappings are the established way to redirect such URI lookups.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
|
||
| const auto cached{this->fetched_.find(target)}; | ||
| if (cached != this->fetched_.cend()) { | ||
| return cached->second; |
There was a problem hiding this comment.
This cache is keyed by the mapped fetch target, but anonymous schemas are reidentified below with the original requested URI. If two resolve entries point different external URIs at the same no-$id file, the second reference receives the cached schema carrying the first URI as its identity, so bundling resolves it under the wrong identifier.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| base_dialect.value()); | ||
| return schema; | ||
| const auto &stored{ | ||
| this->descriptions_.emplace(target, std::move(document)).first->second}; |
There was a problem hiding this comment.
Lazily fetched descriptions are indexed only by their retrieval URI here, whereas import_description() also indexes a 3.2 document by its declared $self. After a local shared.json with $self: "https://example.com/shared" is fetched once, a later reference to that $self URI cannot reuse it and fails without --http (or embeds a second copy with HTTP enabled).
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Signed-off-by: Juan Cruz Viotti jv@jviotti.com