Open birnbuazn opened 1 month ago
Hi @birnbuazn, thanks for raising this.
One work-around could be to set them as an environment variable (or put them into a .env
file), and then refer to them using the ${env.SOME_VAR}
syntax.
We were considering having something like the components concept that OpenAPI specs use, for reusable elements in a config file. Would something like this work for you?
Both would work in my case, I guess.
The workaround with the environment variables seems tempting, although it might obscure things a bit, because the regex pattern in my case would be defined outside the YAML file, which can make it easier to read, because you get a nice label for the pattern. On the other hand, it might be a little harder for people to reason about the spec. if some arbitrary environment variables are defined elsewhere.
A fully blown components concept would of course be helpful. Might be a bit too much, though for my use case. Would you consider referencing simple String values as well?
Seems like you are using Jackson Dataformats YAML under the hood, which unfortunately doesn't handle anchors and references in YAML files nicely:
https://github.com/FasterXML/jackson-dataformats-text/issues/98
Which is a pain, because I want to reuse regex patterns in my config file, which currently does not work: