Skip to content

Somehow writeOnly seems to have broken? Bug? #604

Closed
@BasMichielsen

Description

I have the following simple struct for which I want a speciesID when a new record needs to be added (in request) but when used as a response the speciesID field should not be present. I very much believe this used to work a few huma versions earlier, but now in the response the field appears to be there. Also, removing writeOnly="true" has no effect, in both cases the same behaviour is exhibited.

type Animal struct {
	ID        string `json:"ID" format:"uuid" readOnly:"true" doc:"The ID of this animal."`
	Name      string `json:"name" doc:"The name of this animal."`
	SpeciesID string `json:"speciesID" format:"uuid" writeOnly:"true"`
}

Funny addition: Stoplight's Response Example does not contain the field speciesID but the true response does. So somehow Stoplight thinks it should not be there, probably because of the writeOnly="true" tag, yet it seems somewhere internally the field is not removed from the response.

image

image

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions