-
Notifications
You must be signed in to change notification settings - Fork 20
feat: add PoC of handling discriminator for allOf case in OpenAPI 3.1 #4959
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
Conversation
0c77fa4
to
f9d460b
Compare
packages/apidom-ns-openapi-3-1/src/refractor/plugins/normalize-discriminator-mapping.ts
Show resolved
Hide resolved
f9d460b
to
de17035
Compare
@@ -531,6 +532,11 @@ export const visit = ( | |||
|
|||
// cycle detected; skipping over a sub-tree to avoid recursion | |||
if (detectCycles && ancestors.includes(node)) { | |||
if (typeof detectCyclesCallback === 'function') { | |||
// @ts-ignore | |||
detectCyclesCallback(node, key, parent, path, ancestors); |
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.
adding types for visit options argument would fix that error
It seems there are many issues within typings. If resolving all TS errors exceeds the scope of the task, we can handle it in a separate ticket |
1d5517d
to
4ad3864
Compare
4ad3864
to
c1c8b7d
Compare
Let's handle it separately - we have many similar cases with the typings, we could try addressing them as well. |
Notes on the idea of handling
allOf
discriminator:Dereference: dereferenced value of SchemaElement should be stored within
allOfDiscriminatorMapping
ifschemaName
metadataschemaName
metadataNormalization: should be similar to oneOf/anyOf discriminator normalization but this time we will be creating the normalized mapping based on the items of
allOfDiscriminatorMapping
instead of items of oneOf/anyOf fields. External references and references not pointing to internalcomponents/schemas/<schemaName>
are also not being handled here.