Repository navigation
fix(compilers/openapi): keep format: password at every position #592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fuad-daoud
wants to merge
7
commits into
main
Choose a base branch
from
relevo/secret-format
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,466
−39
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d7650c9
fix(compilers/openapi): keep format: password at every schema positio…
fuad-daoud ecbeb0b
test(compilers/openapi): order the corpus golden writer before its re…
fuad-daoud d447868
style(testdata): end the secret-format fixture with a newline
fuad-daoud 713128d
Merge origin/main into relevo/secret-format
fuad-daoud 472c40a
Merge origin/main into relevo/secret-format
fuad-daoud 291a221
fix(compilers/openapi): mark every use that reaches a redaction node
fuad-daoud c2bef74
test(compilers/openapi): run the corpus tests in parallel again
fuad-daoud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reordering
allOfbranches now changes the merged field, and one order silently loses detail.Repro:
allOfof{properties: {token: {type: string}}}and{properties: {token: {type: string, format: password, minLength: 8, default: x, description: d, example: e}}}.default,constraints.minLength,docs.description,examplesandsecret.t/prim/string,secret: true, and the default, constraints, description and example are gone from the property; the whole password declaration is parked underopenapi:conflicting-redeclaration<ptr>.t/anon/.../allOf/0/properties/tokenand the default and constraints are kept.mergeVisibilitydocuments that allOf gives branch order no meaning, and the order-invariance oracle does not reorder allOf branches, so the corpus sweep cannot see this. The comment here ("the format drops") understates it: it is every shape detail of the redeclaration that drops, and in the password-first order it is the plain declaration that is dropped instead.Suggest treating a format-only hoist difference as a compatible narrowing (fold the details, pick the richer type independent of order) rather than leaving it to #446, or at minimum reporting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three corrections to this comment.
password, whichmainfolds because it resolves to the shared primitive.main:hex-tokenbeside a plainstringgivest/prim/stringwith no default or bounds when the plain branch is first, keeps both when the format branch is first, and reports nothing in either order. That is now openapi: an allOf redeclaration of a property with an unknown format is resolved by branch order #782.byteis not part of it; it reports an incompatible-types warning.typesConflictreporting a conflict between primitive kinds that can both hold. HeretypesConflictresolves the Scalar tostring, reports nothing, and the shape fold still discards one side. Please point this comment at openapi: an allOf redeclaration of a property with an unknown format is resolved by branch order #782 instead.I did not find this shape in a sweep of 157 real-world specs that use
format: password, so the cost is the order dependence and the lost typed fields, not something it hits in practice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repointed to #782 in 291a221. The comment now says the later declaration is dropped whole, its shape details with it, and that which declaration that is depends on branch order. I left the fold itself to #782: it is the same mechanism that
hex-tokenalready hits onmain, and fixing it only forpasswordwould leave the two disagreeing.