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

ResourceTypeSchema fails when loading resource definitions using 'oneOf', 'if' keywords #70

Open
vladtsir opened this issue Dec 15, 2019 · 1 comment

Comments

@vladtsir
Copy link
Contributor

Error:

java.lang.ClassCastException: org.everit.json.schema.CombinedSchema$Builder cannot be cast to org.everit.json.schema.ObjectSchema$Builder
	at software.amazon.cloudformation.resource.ResourceTypeSchema.load(ResourceTypeSchema.java:110)

To reproduce create a schema file as follows:

valid-with-oneof.json:

{
  "typeName": "AWS::Test::TestModel",
  "description": "A test schema for unit tests.",
  "sourceUrl": "https://mycorp.com/my-repo.git",
  "properties": {
    "propertyA": {
      "type": "string"
    },
    "propertyB": {
      "type": "string"
    }
  },
  "oneOf": [
    { "required":  ["propertyA"]},
    { "required" : ["propertyB"]}
  ],
  "primaryIdentifier": [
    "/properties/propertyA"
  ],
  "additionalProperties": false
}
public void validSchema_withOneOf_shouldSucceed() {
        JSONObject resource = loadJSON("/valid-with-oneof.json");
        final ResourceTypeSchema schema = ResourceTypeSchema.load(resource);
}
vladtsir added a commit to vladtsir/aws-cloudformation-resource-schema that referenced this issue Dec 16, 2019
vladtsir added a commit to vladtsir/aws-cloudformation-resource-schema that referenced this issue Dec 16, 2019
vladtsir added a commit to vladtsir/aws-cloudformation-resource-schema that referenced this issue Dec 16, 2019
vladtsir added a commit to vladtsir/aws-cloudformation-resource-schema that referenced this issue Feb 1, 2020
vladtsir added a commit to vladtsir/aws-cloudformation-resource-schema that referenced this issue Feb 1, 2020
vladtsir added a commit to vladtsir/aws-cloudformation-resource-schema that referenced this issue Feb 1, 2020
vladtsir added a commit to vladtsir/aws-cloudformation-resource-schema that referenced this issue Feb 2, 2020
@PatMyron
Copy link
Contributor

@vladtsir does #81 fix this?

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

No branches or pull requests

2 participants