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

Support multiple input values in api enum query params #6716

Open
dirkjanp opened this issue Apr 23, 2024 · 1 comment
Open

Support multiple input values in api enum query params #6716

dirkjanp opened this issue Apr 23, 2024 · 1 comment

Comments

@dirkjanp
Copy link

❗ please do not add sensitive information in issues, you can provide extra information via email using issue number as reference ❗

Describe the issue
In an api receiver adapter you can define input query params which are validated against an xsd. The xsd element can be an enum.
If you then want to add multiple input of the same query param to do a "where in ('')" search, this input gets rejected by the json2xml validator.

Reporter
Dirk-Jan

To Reproduce

  • Make an api receiver adapter with input query params that are validated with a json2xml validator.
  • Send multiple input values

xsd element pets with enum values dog and cat

For example:
OK: GET /apicall?pets=dog
OK: GET /apicall?pets=cat
NOT OK: GET /apicall?pets=dog|cat

Value "dog|cat" gets rejected by the xsd validation.

When "pets" would be a string, then there is no issue and multiple input values with a separator work fine.

@Laurens-makel
Copy link
Contributor

I'm not surprised that the value dog|cat is rejected by the XSD validator since it's not a valid enum value. Could you try regular expression based validation instead of relying on enumerations?

To stay within the pets theme, here is a matching example:

<xs:simpleType name="PetType">
  <xs:restriction base="xs:string">
    <xs:pattern value="(?:cat|dog|goldfish|hamster|parrot)(?:\|(?:cat|dog|goldfish|hamster|parrot))*"/>
  </xs:restriction>
</xs:simpleType>

In this pattern:

(?:cat|dog|goldfish|hamster|parrot) matches any of the allowed pet types without capturing it.
(?:\|(?:cat|dog|goldfish|hamster|parrot))* allows for zero or more occurrences of a pipe followed by any of the allowed pet types.

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