-
Notifications
You must be signed in to change notification settings - Fork 14
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
Improve OpenAPI generator #90
Conversation
Refactor codegen to no longer rely on eval and printing, taking advantage of the ability to pass a cue.Value to the CUE standard library package. Also introduce support for a group flag, which allows translating only the children of the root schema to OpenAPI. And introduce a long-overdue test txtar-based test framework.
cc @undef1nd - fyi, this testing system should be equally useful for what you've been looking at with JSON Schema generation |
09bcfec
to
517e9af
Compare
This testing system is 🔥 . It can treat the exemplar set as a corpus for tests using only a single flag. Add a new exemplar to the corpus, and it instantly flows to all tests using the framework. |
I've also added a This is mostly ready to go. The nasty bug with extra files being appended to txtar when golden updates are on remains, and i also have to figure out why some Go types aren't rendering in grok. Once those are licked, though, this is ready to merge. |
This is in good shape. But there are some follow-ups. I had to fork CUE for some fixes - there were a couple key cases that weren't covered (conjuncts in numeric value types, selectors on object types). This substantially impacted Go codegen elsewhere, being the difference between obviously incorrect and probably correct. The test framework itself is also in a messy, halfway state. In retrospect, i realize what i was really trying to do was graft a subtest layer on top of the txtar-specific test runner. The framework itself already creates a subtest per txtar, but i was effectively trying to make each provided subtest executed from there be able to construct its own subtests in a way that's basically similar to stdlib Given that the central object in the framework is the lineage, this is crucial to allow for more standard helpers that, for example, allow a particular test case to be executed across all schemas in a lineage, and keeping each subtest's output therein tidily namespaced. |
Refactor codegen to no longer rely on eval and printing, taking
advantage of the ability to pass a cue.Value to the CUE standard library
package.
Also introduce support for a group flag, which allows translating only the
children of the root schema to OpenAPI.
And introduce a long-overdue test txtar-based test framework.
cc @IfSentient