Skip to content
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

Closes #17 Dynamically create inner schemas derived from spec schemas #20

Merged
merged 1 commit into from
Oct 29, 2023

Conversation

walsha2
Copy link
Contributor

@walsha2 walsha2 commented Oct 29, 2023

Updated schema generation logic, improved tests.

@walsha2
Copy link
Contributor Author

walsha2 commented Oct 29, 2023

I'm trying to generate a client for the OpenAI API (mainly focusing on Completions, Chat and Embeddings endpoints for now).

@davidmigloz - can you try this latest version of the generator on main (as of this PR) and see how it fairs? The only thing remaining is #13 and I think that would result in a completely type safe Dart client!

Feel free to report any issues you uncover or additional requests.


PS you can always dump the resulting, custom, spec generated by openapi_spec into a reproducible file, as seen in the tests. This will capture all of the extra schemas that this package dynamically generates that are not officially defined in the spec.

make test && cat test/tmp/openai/openai.json

@walsha2 walsha2 merged commit 46e1989 into main Oct 29, 2023
1 check passed

/// A mapping of any extra schemas that this generator created and the parent schema
/// that they were created from. This is used to improve the generated schema library
@Default({}) Map<String, List<String>> extraSchemaMapping,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New property added to OpenApi object to track extra schema(s) that were generated and from which parent they belong. Used in the generators, but exposed to the user since openapi_spec is making assumptions and essentially generating new schemas on the fly that may not be obvious from inspecting the source spec.

@walsha2 walsha2 mentioned this pull request Oct 30, 2023
@walsha2 walsha2 deleted the inner-schema-types branch October 31, 2023 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant