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 validation feature for patterns only #326

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

willosborne
Copy link
Member

This adds a simple validation mode that checks the provided pattern is valid JSON Schema; this isn't perfect but it gives us some guarantees.

Addresses issue #73 and #317

@willosborne
Copy link
Member Author

This is a good first cut, but I think we can improve upon this later - e.g. running with -v shows loads of 'strict mode' errors that could be useful here:

debug:   Pattern Instantiation was not provided, only the JSON Schema will be validated
strict mode: unknown keyword: "defs"
strict mode: unknown keyword: "defs"
strict mode: required property "deployed-in" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/0" (strictRequired)
strict mode: required property "composed-of" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/1" (strictRequired)
strict mode: required property "interacts" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/2" (strictRequired)
strict mode: required property "connects" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/3" (strictRequired)
strict mode: "prefixItems" is 4-tuple, but minItems or maxItems/items are not specified or different at path "#/properties/nodes"
strict mode: missing type "object" for keyword "required" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/nodes/prefixItems/0" (strictTypes)
strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/nodes/prefixItems/0" (strictTypes)
strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/nodes/prefixItems/1" (strictTypes)
strict mode: missing type "object" for keyword "required" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/nodes/prefixItems/2" (strictTypes)
strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/nodes/prefixItems/2" (strictTypes)
strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/nodes/prefixItems/3" (strictTypes)
strict mode: "prefixItems" is 3-tuple, but minItems or maxItems/items are not specified or different at path "#/properties/relationships"
strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/relationships/prefixItems/0" (strictTypes)
strict mode: required property "deployed-in" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/0" (strictRequired)
strict mode: required property "composed-of" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/1" (strictRequired)
strict mode: required property "interacts" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/2" (strictRequired)
strict mode: required property "connects" is not defined at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-04/meta/core.json#/properties/relationship-type/oneOf/3" (strictRequired)
strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/relationships/prefixItems/1" (strictTypes)
strict mode: missing type "object" for keyword "properties" at "https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/pattern/api-gateway#/properties/relationships/prefixItems/2" (strictTypes)
info:    The JSON Schema is valid

Catch errors in compile() to detect schema issues

Tweaks to validate

temp

Fix bug in merging of results

Undo test changes made to api-gateway.json

Clean up the pattern-only logic

api-gateway.json fix
@willosborne willosborne force-pushed the pattern-only-validation branch from 636a74c to 093919c Compare August 2, 2024 15:48
@willosborne willosborne merged commit 6834b45 into finos:main Aug 5, 2024
4 checks passed
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.

3 participants