Skip to content

Validate resource before deserialize into resource model #273

Closed

Description

@wbingli

As for now, Java plugin will deserialize the raw resource property into resource model before validation.

If the resource property is an invalid structure, e.g. pass a String but schema requires a List, it will fail sadly. And CloudFormation will show Internal Failure for this resource.

If validate resource before deserialize it, it can validate such invalid resource properly.

Activity

  1. rjlohan commented on Jun 8, 2020

    @rjlohan
    Contributor

    Before making changes here, verify the history of the serialization behaviour. e.g;

    Validating the raw JSON can produce other errors, or fail with false negatives if it's not ordered correctly.

  2. wbingli commented on Jun 8, 2020

    @wbingli
    Author

    Before making changes here, verify the history of the serialization behaviour. e.g;

    Validating the raw JSON can produce other errors, or fail with false negatives if it's not ordered correctly.

    The PR #274 do consider for such case. It will only try to catch MismatchedInputException if the first deserialization fails due to mismatch type. This avoid the false negative for the stringifier issue but provide useful information if type mismatch.

    The following validation is kept as-is so that it will validate based on the converted resource model.

  3. wbingli commented on Jun 10, 2020

    @wbingli
    Author

    Resolving as the fix is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions