Skip to content

Conversation

@fnesveda
Copy link
Member

Disallow empty enums in input schema, to make schemas like this invalid:

{
    // ...
    properties: {
        myField: {
            title: 'Field title',
            type: 'string',
            description: 'Some description',
            enum: []
        }
    }
};```

@fnesveda fnesveda added bug Something isn't working. adhoc Ad-hoc unplanned task added during the sprint. t-core-services Issues with this label are in the ownership of the core services team. labels May 10, 2023
@fnesveda fnesveda added this to the 63rd sprint - Platform team milestone May 10, 2023
@fnesveda fnesveda requested review from drobnikj and gippy May 10, 2023 10:26
@fnesveda fnesveda self-assigned this May 10, 2023
};

expect(() => validateInputSchema(validator, schema)).toThrow(
'Input schema is not valid (Field schema.properties.myField.enum.enum must NOT have fewer than 1 items)',
Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea why there is .enum.enum here, but AJV codebase is such a mess and I don't have the motivation to debug it deeper

@fnesveda fnesveda merged commit 54e5296 into master May 10, 2023
@fnesveda fnesveda deleted the fix/disallow-empty-enums branch May 10, 2023 13:56
@fnesveda fnesveda added the validated Issues that are resolved and their solutions fulfill the acceptance criteria. label May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. bug Something isn't working. t-core-services Issues with this label are in the ownership of the core services team. validated Issues that are resolved and their solutions fulfill the acceptance criteria.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants