openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[PHP] Handle non-required property as nullable

Open fMads opened this issue 8 years ago • 1 comments

Description

When a property isn't required, it is not shown in Doc Block, that the getter can actually return "null". Also it is not shown in the setter, that "null" is a valid value

Swagger-codegen version

3.0.0-SNAPSHOT

Swagger declaration file content or url
  /path
    post:
      parameters:
        - in: body
          required: true
          name: objectName
          schema:
            type: object
            required:
              - requiredPropertyName
            properties:
              requiredPropertyName:
                type: string
              notRequiredPropertyName:
                type: string
Suggest a fix/enhancement

Change returnType in Doc Block for getters to correctly show, that the returned value can be null (if the property is not required). Also shown in Doc Block for setters, that value can be null (if property is not required)

fMads avatar May 22 '18 06:05 fMads

Closed via #129

jimschubert avatar Jun 10 '18 17:06 jimschubert