nextcloud / neon

A framework for building convergent cross-platform Nextcloud clients using Flutter.
Other
122 stars 29 forks source link

Support generating code for JSON schema files #933

Open provokateurin opened 11 months ago

provokateurin commented 11 months ago

Dynamite is already able to generate JSON schemas, but not directly from a JSON schema file. A second builder should be introduced to support this. Some code refactoring that separates the two features more is likely needed.

Leptopoda commented 11 months ago

Having this code separate would also allow us to easily generate the api and the schema separately like:

core.openapi.dart
core.schema.dart

With the first one importing the later.

This might make larger specs both more readable and more performant to build (thinking about talk)

provokateurin commented 11 months ago

We still can't output two files in a single builder, so that won't work (but it would be pretty nice).

Leptopoda commented 11 months ago

But if we have two builders we could chain them together in the build.yaml

provokateurin commented 11 months ago

Then we would still need two separate inputs I think

Leptopoda commented 11 months ago

I think this is worth testing before going ahead with the issue.

I think this is possible with some build.yaml magic.

provokateurin commented 11 months ago

For the initial implementation I would just try to get this working. Afterwards we can improve our OpenAPI support by trying to separate the two steps.

Leptopoda commented 5 months ago

I did have a look at this and the only limitation I found was our current code around reference resolving ($ref). We always pass the entire openapi spec arround in our resolving code while the only use is for reference resolving.

Our current reference resolving is very limited and needs to be rewritten. I tried a few ways to fix them but the only one that worked was a bit ugly.