fix(api-type-document): suppress main-example section for Nil types @W-23748889 - #99
Open
alexpmule wants to merge 1 commit into
Open
fix(api-type-document): suppress main-example section for Nil types @W-23748889#99alexpmule wants to merge 1 commit into
alexpmule wants to merge 1 commit into
Conversation
|
Thanks for the contribution! Unfortunately we can't verify the commit author(s): Alex Perez <a***@s***.com>. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, refresh the status of this Pull Request. |
…lable-union types The standalone main-example section was rendered (empty) for Nil-typed properties. `set _hasExamples` derived `scalarType` from ScalarShape only, while `_typeChanged` already treats ScalarShape, NilShape, and nullable unions (`type | null`) alike. AMF 5.11.x now materializes an `example: null` as a concrete Example node, so those types began rendering a spurious block. Introduce `_isScalarLikeType` covering ScalarShape, NilShape, and nullable unions (via `_checkNullableUnion`), operating on the resolved type for parity with `_typeChanged`, and use it in both `set _hasExamples` and `set noMainExample`. Nullable unions are the dominant OAS 3.1/3.2 shape, so their coverage is required, not incidental. Add generator-independent regression tests (inline AMF nodes) locking Nil, nullable-union, and positive-control behavior, plus direct `_isScalarLikeType` unit tests. Fix a vacuous existing assertion that queried a nonexistent `examples` tag instead of `.examples`. @W-23748889
alexpmule
force-pushed
the
W-23748889/nil-shape-main-example
branch
from
August 16, 2026 02:36
14adf87 to
aae3d54
Compare
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.
What
Suppress the standalone main-example section for Nil-typed properties.
Why
set _hasExamplesonly treatedScalarShapeas scalar-like when deciding whether to render the standalone main example, whereas_typeChangedalready treatsScalarShapeandNilShapealike. AMF 5.11.x now materializes anexample: nullas a concreteExamplenode, so Nil types started rendering a spurious (empty) main-example block.How
_isScalarLikeType(type)→ScalarShape || NilShape, mirroring_typeChanged.set _hasExamplesandset noMainExampleso Nil types suppress the main-example section, matching existing scalar behavior.Verification
Patched the installed copy of this component (4.2.43) inside the API Console v6 worktree with these exact changes and ran the full console unit suite (Node 18, Playwright/Chromium):
test/api-console-documentation.test.js(contains theNil typecases): 115 passing, 0 failed.Without the fix, the Nil-type cases fail because the empty
.examplessection is rendered instead of hidden.Version bumped
4.2.43 → 4.2.44so CI publishes the new release on merge.@W-23748889
🤖 Generated with Claude Code