Skip to content

[BUG] [GO] ReadOnly fields are marshaled into json #12551

@kke

Description

@kke

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 (example)
Description

The JSON/YAML says:

        createdAt:
          description: The date the Secret entity was created.
          format: date-time
          readOnly: true
          type: string

The go struct looks like:

	// The date the Resource entity was created.
	CreatedAt time.Time `json:"createdAt"`

And the MarshalJSON function:

	if true {
		toSerialize["createdAt"] = o.CreatedAt
	}
openapi-generator version

The one that comes from docker run openapitools/openapi-generator-cli

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions