Skip to content

enum generation #37

Open
Open
@rssdev10

Description

@rssdev10

Probably wrong generation of the enum type.

    DocumentMetadata:
      type: object
      properties:
        source:
          $ref: "#/components/schemas/Source"
    Source:
      title: Source
      enum:
        - email
        - file
        - chat
      type: string
      description: An enumeration.

Expectation is to have

      "metadata": {
       "source": "file"
     }

and an equivalent code in Python

class Source(str, Enum):
    email = "email"
    file = "file"
    chat = "chat"

But in fact we have:

Base.@kwdef mutable struct Source <: OpenAPI.APIModel

    function Source()
        return new()
    end
end # type Source

const _property_types_Source = Dict{Symbol,String}()
OpenAPI.property_type(::Type{ Source }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_Source[name]))}

function check_required(o::Source)
    true
end

function OpenAPI.validate_property(::Type{ Source }, name::Symbol, val)
end

And de-serialization is working for the code only:

      "metadata": {
        "source": {"file":"file"}
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions