fix(asm): replace OAS 3.0 nullable: true with OAS 3.1 type unions#4
Open
dmchaledev wants to merge 1 commit into
Open
fix(asm): replace OAS 3.0 nullable: true with OAS 3.1 type unions#4dmchaledev wants to merge 1 commit into
nullable: true with OAS 3.1 type unions#4dmchaledev wants to merge 1 commit into
Conversation
`nullable: true` is an OpenAPI 3.0 keyword that is silently ignored in OAS 3.1 (JSON Schema draft 2020-12). The five affected fields — Scan.label, Scan.started_at, Scan.completed_at, ScanDetail.error_message, and Vulnerability.cvss_score — are replaced with `type: [T, 'null']`, the correct OAS 3.1 form. Without this fix, code generators targeting OAS 3.1 produce non-nullable types, causing type errors at runtime when the API returns null for these fields. https://claude.ai/code/session_01RpWy2Xow4dh8HhFYwcfGRS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
asm/openapi.yamldeclaresopenapi: 3.1.0but usesnullable: truein five field definitions. This is an OpenAPI 3.0 keyword that is silently ignored under OAS 3.1 (which is based on JSON Schema draft 2020-12). Any OAS 3.1-aware tool — code generators, validators, mock servers — will treat those fields as non-nullable, causing type errors at runtime when the API returnsnull.Affected fields:
ScanlabelnulllabelScanstarted_atScancompleted_atScanDetailerror_messageVulnerabilitycvss_scoreFix
Replace
nullable: truewith the OAS 3.1 / JSON Schema 2020-12 type union syntax:Test plan
spectral lint asm/openapi.yaml --ruleset spectral:oaspasses with no warnings aboutnullableopenapi-generator-cli generate -g typescript-fetch) produces nullable/optional types for the five fields abovehttps://claude.ai/code/session_01RpWy2Xow4dh8HhFYwcfGRS
Generated by Claude Code