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

feat: add all_of and condition to specify a sub jsonschema as a type #43

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sguiheux
Copy link

@sguiheux sguiheux commented Sep 7, 2022

Hi,

To be a little more specific than the tag: "oneof_type=string,array", I add a new one that use "all_of" and condition to specify the type of field.

type Application struct {
    Name          string          `json:"name"`
    Kind          string          `json:"kind"`
    Specification json.RawMessage `json:"spec" jsonschema_allof_type:"kind=docker:#/$defs/dockerApp, kind=vm:#/$defs/vmApp"`
}

With this type of struct when the content of a field ( Specification ) depends of another one, we can specify in the jsonschema the right type, and make jsonschema validation works

As it does not affect directly the type of field ( because it adds a all_of on the parent ), I do not implements this in the tags jsonschema like oneof_type, cleaner and more readable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant