guardrail-dev / guardrail-dev/guardrail
Allow for ignoring certain schemas with vendor extension
- Dominant language
- Scala
- Stars
- 541
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Description
It is possible to write a valid entry in `schemas` that Guardrail generates uncompilable code for. A good example is a schema using `oneOf`, which isn't currently supported (see #195). While we can ideally try to support every OpenAPI feature in Guardrail, I think that there's always potential for being a bit behind.
What's lacking currently is a way to exclude certain `schema` entries from being used to generate code. If we had this, we could exclude problematic/unimplemented ones, count on Guardrail to inline the missing type, and manually write the corresponding model and (de)serializers. I was thinking of a vendor extension like `x-scala-ignore`, similar to what's discussed in #183, but for entries in `schemas`.
Does this sound like a worthwhile feature? I had a quick look at implementing it, but had trouble understanding how the vendor extensions work. Ultimately it seems like filtering the definitions [here](https://github.com/twilio/guardrail/blob/master/modules/codegen/src/main/scala/com/twilio/guardrail/ProtocolGenerator.scala#L701) would do the trick?
Contributor guide
Assessment
This issue has not been assessed yet.