swagger-api / swagger-api/swagger-codegen

[PHP] minimum/maximum not reflected

Open
#9,997 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

minimum and maximum values on properties do not get reflected to the PHP classes.

Swagger-codegen version

Docker CLI container

docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3 generate \
    -i /local/out/quantities.yml \
    -l php \
    --api-package Quantities \
    -o /local/out/quantities
Swagger declaration file content or url

https://swagger.io/docs/specification/data-models/inheritance-and-polymorphism/

properties:
       quantity:
          type: integer
          minimum: 100
          maximum: 600

The output does not reflect any >= 100 <= 600 comparison.

When type = string and instead of minimum/maximum we add enum with some values, there is getting a lot of stuff into the PHP classes (with a method getQuantityAllowableValues() on the model). There is no such thing with integer and minimum/maximum.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown Docker CLI command, using the quantities.yml declaration and PHP output. Compare the generated model for quantity with the minimum: 100 and maximum: 600 constraints; done means the generated PHP classes reflect those bounds similarly to enum values.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, openapi, php
Domain
api, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.