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

[BUG] [Python] arrays validation problems for maxItems/minItems #7142

Closed
4 of 6 tasks
SapMaria opened this issue Aug 6, 2020 · 2 comments
Closed
4 of 6 tasks

[BUG] [Python] arrays validation problems for maxItems/minItems #7142

SapMaria opened this issue Aug 6, 2020 · 2 comments

Comments

@SapMaria
Copy link

SapMaria commented Aug 6, 2020

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Validation rules are not added for lists (maxItems/minItems values) to the generated Python SDK (I tested only for Python).

I also tried to add validation rules for string, number and integer. It's ok.

openapi-generator version

4.3.1 (additionaly checked on latest 5.0.0-beta)

OpenAPI declaration file content or url
requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                os:
                  type: object
                  required:
                    - name
                    - version
                  properties:
                    name:
                      type: string
                    version:
                      type: string
                packages:
                  type: array
                  minItems: 1
                  maxItems: 5
                  items:
                    type: string
Generation Details
java -jar openapi-generator-cli-4.3.1.jar generate  -i v1.yaml -g python -o ~/projects/sdk-openapi
Steps to reproduce

Just use generator script with default options for python.

Related issues/PRs

Not found.

@auto-labeler
Copy link

auto-labeler bot commented Aug 6, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@spacether
Copy link
Contributor

This ticket is stale and should be fixed in master.
maxItems and minItems validations are checked here:
https://github.com/OpenAPITools/openapi-generator/blob/master/samples/openapi3/client/petstore/python/petstore_api/model_utils.py#L777-L797

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

No branches or pull requests

2 participants