Validate parent nodes in manifests
Check if item under requires section is a concrete Type. If yes, it needs to be attached to the parent node. For example:
requires:
cap.core.type.platform:
oneOf:
- name: cap.type.platform.nomad # this MUST be attached to `cap.core.type.platform`
revision: 0.1.0
Validate that additionalRefs always point to abstract node (parent node) not to a concrete Type.
In fsvalidator_test.go I added only simple cases. Corner cases were extracted to json_remote_implementation_test.go.
Replace “hard-coded” ListTypeRefRevisionsJSONSchemas with generic ListTypes function in Hub client
Introduce a single FakeHubCli with related "fixtures" and remove all copies inside our code
Validating files in 5 concurrent jobs...
- ✗ "manifests/implementation/mattermost/mattermost-team-edition/install.yaml":
* RemoteImplementationValidator: Type cap.type.aws.auth.credentials is not attached to cap.core.type.platform abstract node
Change additionalRefs in the cap.type.platform.cloud-foundry manifests from cap.core.type.platform to cap.core.type.platform.kubernetes
Execute validation one more time to see error with wrong parent node:
- ✗ "manifests/type/platform/cloud-foundry.yaml":
* RemoteTypeValidator: cap.core.type.platform.kubernetes cannot be used as parent node as it resolves to concrete Type
Description
Changes proposed in this pull request:
requires
section is a concrete Type. If yes, it needs to be attached to the parent node. For example:fsvalidator_test.go
I added only simple cases. Corner cases were extracted tojson_remote_implementation_test.go
.ListTypeRefRevisionsJSONSchemas
with genericListTypes
function in Hub clientTesting
Build CLI:
make build-tool-cli
Pick some Implementation manifest and add change
requires
property:Execute validation against local manifests: NOTE: use the CLI from this PR
you should see:
Change additionalRefs in the
cap.type.platform.cloud-foundry
manifests fromcap.core.type.platform
tocap.core.type.platform.kubernetes
Execute validation one more time to see error with wrong parent node:
Related issue(s)