Fix OpenAPI3 import: support JSON Schema sibling keywords with $ref #9634
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OpenAPI 3.1+ uses JSON Schema 2020-12, which permits sibling keywords alongside
$ref. The importer ignored these keywords, dropping default values, constraints (min/max length/items/value), descriptions, and deprecation flags when schemas referenced other schemas with overrides.Example that now works correctly:
Generates:
Changes
getDecoratorsForSchema()andgetDirectivesForSchema()now check for sibling keywords when$refis present, resolve the reference to determine schema type, then apply constraint decorators based on the resolved typegenerateTypeFromRefableSchema()extracts default values from schemas with$ref, generating proper enum member references (e.g.,OrderEnum.desc) for enum typesdirectivesfield toTypeSpecOperationParameterinterface, populated from schema during transformation, rendered in operation generationContextthrough the call chain, enabling $ref resolution during decorator extractionSupports all sibling keywords that map to TypeSpec:
default,minItems/maxItems,minimum/maximum/exclusiveMinimum/exclusiveMaximum,minLength/maxLength,deprecated,description,title.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
telemetry.astro.build/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/typespec/typespec/website/node_modules/.bin/../astro/astro.js build sh -c ebsite/src/conte--llmstxt sed .0_tmp_4071/node../../website/src/content/docs/docs/emitters/openapi3/reference --no-emit bash /.bin/node sh /nod�� tsc -p tsconfig.build.json sh tools/pnpm/10.23.0_tmp_4071/node--output-dir --no-emit l/reference s/.bin/tspd sh(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.