Skip to content

Produce a JSONSchema for the mock HTTP config.yml files #169

@andrewkroh

Description

@andrewkroh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions