Skip to content

[GENERATOR ISSUE] Parse nullable option in additionalProperites #67

@LarsWl

Description

@LarsWl

Hi, I'm trying to generate julia client for hubspot api, and there is such a component:

"SimplePublicObjectWithAssociations": {
        "type": "object",
        "properties": {
          ...
          "properties": {
            "example": {
              "amount": "1500.00",
              "closedate": "2019-12-07T16:50:06.678Z",
              "hubspot_owner_id": "910901",
              "dealname": "Custom data integrations",
              "dealstage": "presentationscheduled",
              "pipeline": "default"
            },
            "additionalProperties": {
              "nullable": true,
              "type": "string"
            },
            "type": "object"
          },
      }
      ...
}

So openapi-generator generate such model:

Base.@kwdef mutable struct SimplePublicObjectWithAssociations <: OpenAPI.APIModel
    archivedAt::Union{Nothing, ZonedDateTime} = nothing
    archived::Union{Nothing, Bool} = nothing
    properties::Union{Nothing, Dict{String, String}} = nothing
    id::Union{Nothing, String} = nothing
    updatedAt::Union{Nothing, ZonedDateTime} = nothing
    associations::Union{Nothing, Dict} = nothing # spec type: Union{ Nothing, Dict{String, CollectionResponseAssociatedId} }
    createdAt::Union{Nothing, ZonedDateTime} = nothing
    propertiesWithHistory::Union{Nothing, Dict{String, Vector{ValueWithTimestamp}}} = nothing
#  ...
end

There is a field properties which is of type Dict{String,String}. So it processes the type field in additionalProperties to detect String, but it doesn't process the nullable field. So if I have a property with a null value, it throws an error on parsing. I was able to fix it by changing the type to Dict{String,Union{Nothing, String}}, so maybe there is a way to update generator to process the nullable option

Edit:
Full openapi_specification: https://api.hubspot.com/api-catalog-public/v1/apis/crm/v3/objects/deals

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions