Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

[BUG] AdditionalProperties referenced when it does not exist, object + composition #54

Closed
@spacether

Description

@spacether

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request

AdditionalProperties referenced when it does not exist, schema type is object + composition

Description

AdditionalProperties referenced when it does not exist, schema type is object + composition

openapi-json-schema-generator version

opeanpi-generator latest (should be functionally equivalent to this)

OpenAPI declaration file content or url
components:
  schemas:
    AbstractStepMessage:
      required:
        - description
        - discriminator
        - sequenceNumber
      type: object
      properties:
        discriminator:
          type: string
      description: Abstract Step
      discriminator:
        propertyName: discriminator
      anyOf:
        - $ref: '#/components/schemas/AbstractStepMessage'

And when instantiating the class one gets:

  File "/Users/justinblack/programming/swagger_cpayne/venv/lib/python3.9/site-packages/openapi_client-1.0.0-py3.9.egg/openapi_client/model/abstract_step_message.py", line 26, in <module>
  File "/Users/justinblack/programming/swagger_cpayne/venv/lib/python3.9/site-packages/openapi_client-1.0.0-py3.9.egg/openapi_client/model/abstract_step_message.py", line 114, in AbstractStepMessage
AttributeError: type object 'MetaOapg' has no attribute 'additional_properties'

And the instantiation signature is:

    def __new__(
        cls,
        *args: typing.Union[dict, frozendict.frozendict, ],
        sequenceNumber: typing.Union[MetaOapg.additional_properties, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
        description: typing.Union[MetaOapg.additional_properties, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, bool, None, list, tuple, bytes, io.FileIO, io.BufferedReader, ],
        discriminator: typing.Union[MetaOapg.properties.discriminator, str, ],
        _configuration: typing.Optional[schemas.Configuration] = None,
        **kwargs: typing.Union[schemas.AnyTypeSchema, dict, frozendict.frozendict, str, date, datetime, uuid.UUID, int, float, decimal.Decimal, None, list, tuple, bytes],
    ) -> 'AbstractStepMessage':

sequenceNumber + description incorrectly refer to nonexistent additional_properties

Generation Details

python

Steps to reproduce
Related issues/PRs
Suggest a fix

This should have been fixed in: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/pull/44/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions