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

Add config option to automatically generate definitions as interfaces (maybe) #64

Open
sdboyer opened this issue Nov 2, 2022 · 1 comment
Labels
kind/feature New feature or request

Comments

@sdboyer
Copy link
Contributor

sdboyer commented Nov 2, 2022

Core CUE generators - like OpenAPI - generally rely on whether a field is a definition or not to decide whether to generate it as a top-level type. Cuetsy has, thus far, decided to go the attribute-driven approach.

There are pros and cons to each approach, but recently i've been noticing that when a given schema is targeted for multiple output languages (as it is in Grafana, TS and Go), having a divergence in how this works can make for some toil and potential for inconsistency.

In general i still want to keep cuetsy attribute-centric, but it does make sense to me that we might add a configurable mode where visited definition fields are treated as being @cuetsy(kind="interface"). (Or, if we're allowing configurability, maybe we allow the default to be either interface or alias 🤷 )

Not actually sure if this is a good idea, but getting it written down in any case.

@sdboyer sdboyer changed the title Consider adding config option to automatically generate definitions as interfaces Add config option to automatically generate definitions as interfaces (maybe) Nov 2, 2022
@frossano-grafana
Copy link

this becomes really a problem when we want to ask external developers to write schemas for, for example, Plugins.
This stays uncategorised until we decide to pick it up.
Downside of waiting too long is the fact that a bunch of schema will need re-writing to be sure they comply with the standard way of declaring that something should be part of the interface

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants