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

Add support of Yaml Schema #318

Merged
merged 4 commits into from Sep 18, 2020
Merged

Conversation

evidolob
Copy link
Collaborator

This PR based on #191, with resolving merge conflicts and tests.

hreeder and others added 3 commits September 15, 2020 09:57
This adds support to the loadSchema function to attempt loading
of a schema file containing YAML formatted schemata.

Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
@evidolob evidolob self-assigned this Sep 16, 2020
@coveralls
Copy link

coveralls commented Sep 16, 2020

Coverage Status

Coverage decreased (-0.02%) to 77.69% when pulling fa38368 on evidolob:yaml-scheme into 9011a97 on redhat-developer:master.

test/yamlScheme.test.ts Outdated Show resolved Hide resolved
Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
}

try {
const schemaContent: JSONSchema = yaml.safeLoad(content);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are doing a simple conversion then I'm concerned that it might not work with k8s yaml schemas. The structure of which has the schema held within it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshuawilson I'm not sure that understand your point, can you add sample of such k8s yaml scheme?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a link to the Knative Eventing Subscription schema. Notice that is has structure wrapping the actual schema.
https://github.com/knative/eventing/blob/master/config/core/resources/subscription.yaml
The schema needed for validation doesn't start until line 32. If we include the rest, will validation actually work?

Copy link
Collaborator Author

@evidolob evidolob Sep 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because that file itself is not YAML Scheme, it is k8's CRD. To get actual scheme you need to extract that yaml in to separate yaml file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fine, I was just hoping to be able to point to the URL for a k8s schema and use it. But I do understand that has become a more generic tool.

@evidolob evidolob merged commit 4a2f1d8 into redhat-developer:master Sep 18, 2020
@evidolob evidolob deleted the yaml-scheme branch September 18, 2020 06:15
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.

None yet

5 participants