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

Postman Schema tests for response body properties that are arrays with min and max items dont match #494

Closed
savage-alex opened this issue Jun 7, 2023 · 10 comments

Comments

@savage-alex
Copy link

Given the following property schema in a response body:

grantTypes:
          description: |
            List of grant types supported for this client.
            As per RFC6749, the clientCredentials grant can only be used by confidential clients.
            Clients SHOULD always only allow Authorization Code with PKCE.
          type: array
          minItems: 1
          maxItems: 2
          uniqueItems: true
          items:
            type: string
            enum:
              - authorizationCodePKCE
              - clientCredentials
            minLength: 0
            maxLength: 100
          example: [authorizationCodePKCE, clientCredentials]

This results in a postman schema test where the min and max items are 1

"grantTypes":{"description":"List of grant types supported for this client.\nAs per RFC6749, the clientCredentials grant can only be used by confidential clients.\nClients SHOULD always only allow Authorization Code with PKCE.\n","type":"array","minItems":1,"maxItems":1,"uniqueItems":true,"items":{"type":"string","enum":["authorizationCodePKCE","clientCredentials"],"minLength":0,"maxLength":100},"example":["authorizationCodePKCE","clientCredentials"]}

We also noted from trying random numbers setting min items to 0 and maxItems to 2
The generated postman schema check dropped maxItems all together.

Happy to provide a full OpenAPI example for testing on request

Thanks

@chyde80
Copy link

chyde80 commented Aug 8, 2023

I am also seeing strange behavior on maxItems. My OAS does not have any maxItems specified in it but portman injected one in one of the schemas for my endpoints. ("maxItems":1)

For now I will probably do a global overwrite (maybe rawReplacement) of it, but would be better if this were fixed.

@thim81
Copy link
Collaborator

thim81 commented Aug 19, 2024

hi @chyde80 & @savage-alex

We did some work in the last version on keeping the original JSON schema.
Is this issue with min & max items still happening?

@thim81
Copy link
Collaborator

thim81 commented Aug 24, 2024

hi @chyde80 & @savage-alex

More news, we were able to streamline the OpenAPI schema to JSON schema conversion further in #644
Solving this long lasting minItems, maxItems behaviour in the JSON schema validation.

Once the PR lands in the next version, let us know if it solved your problems.

@thim81
Copy link
Collaborator

thim81 commented Aug 27, 2024

@savage-alex @chyde80
Another update:
we just released Portman 1.30.1, which contains the enhancements for the OpenAPI to JSON schema conversion, including the fix of the reported unwanted minItems & maxItems modification.

Let us know, if the new version solved this issue.

@savage-alex
Copy link
Author

Getting the team who reported this to pull this version down and try thanks !

@thim81
Copy link
Collaborator

thim81 commented Sep 10, 2024

@savage-alex Did you get already any feedback from the team?
🤞 that they reported that it is solved.

@savage-alex
Copy link
Author

sorry for the delay they are looking at it.

@thim81
Copy link
Collaborator

thim81 commented Sep 11, 2024

@savage-alex
Really, there's no need to apologize, I'm just following up to see if the issue is gone or if we need to continue to spend time on it.

@nileshvaghasiya
Copy link

I have tested it, and the issue is now resolved.

Thank you to everyone involved

@thim81 thim81 closed this as completed Sep 13, 2024
@savage-alex
Copy link
Author

thanks both! job well done

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

4 participants