Skip to content

Confusion about discriminator test case #1449

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

Closed
2 tasks done
H01001000 opened this issue Nov 21, 2023 · 3 comments
Closed
2 tasks done

Confusion about discriminator test case #1449

H01001000 opened this issue Nov 21, 2023 · 3 comments
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library stale

Comments

@H01001000
Copy link

H01001000 commented Nov 21, 2023

Description
Not sure if I understand correctly, for me it seems the discriminator should only exist on the parent schema, and not the child, where the discriminator mapping map the value it has to the child type/$ref. If I am interpreting correctly, it seems the test cases for discriminator are having some issues, eg discriminator > oneOf, the child having discriminator, discriminator > allOf the child having discriminator and point to the parent

may related to #1158

Name Version
openapi-typescript 7.0.0-next.0
Node.js 18.12.0
OS + version Windows 10

Checklist

@H01001000 H01001000 added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Nov 21, 2023
@H01001000 H01001000 changed the title confusion about discriminator test case Confusion about discriminator test case Nov 21, 2023
@drwpow
Copy link
Contributor

drwpow commented Nov 21, 2023

Just so I’m clear, could you point to the specific test you’re referring to, and what you think the correct output types should be?

In general, though, there’s not really a “parent–child” relationship when it comes to composition. When you mark something as allOf you are really just extending that object. I don’t think it’s accurate to call it a “child” node because they’re both on the same level; you’re just saving yourself some typing. So I think you’re intentionally not redeclaring a discriminator when using composition.

But I may be off the mark / missing something. Happy to talk through a more specific example of what’s generated today vs. what you expect to happen if you provide one

Copy link
Contributor

github-actions bot commented Aug 6, 2024

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

@github-actions github-actions bot added the stale label Aug 6, 2024
Copy link
Contributor

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library stale
Projects
None yet
Development

No branches or pull requests

2 participants