The goal is to have a JSON Schema definition for the configuration files that describe the mock HTTP endpoints. This will provide hints and validation in IDEs. It would be used like this
# yaml-language-server: $schema=https://server.com/elastic-stream.schema.json
---
rules:
- path: /api/v1/Foo
methods: ["POST"
or the IDE could be configured based on file path patterns to apply the schema, such that no yaml-language-server hint is necessary.
Requirements
- The JSON Schema should be generated from the structs in the code to ensure the schema is always in sync with the code.
- CI should validate that the schema file in the repo is matches the code.
I have had good experience using https://github.com/invopop/jsonschema to generate schemas from structs that are annotated with jsonschema struct tags. So I would try this path first.
The goal is to have a JSON Schema definition for the configuration files that describe the mock HTTP endpoints. This will provide hints and validation in IDEs. It would be used like this
or the IDE could be configured based on file path patterns to apply the schema, such that no
yaml-language-serverhint is necessary.Requirements
I have had good experience using https://github.com/invopop/jsonschema to generate schemas from structs that are annotated with
jsonschemastruct tags. So I would try this path first.