annotation OpenAPI::Field

Overview

Mark a field with special properties during serialization.

@[OpenAPI::Field(ignore: true)] # Ignore the field
property ignored_field

@[OpenAPI::Field(type: String)] # Enforce a type
property str_field : Int32

# The example value can be any value of type JSON::Any::Type, meaning a string, numbers, booleans, or an array or a hash of json values.
@[OpenAPI::Field(example: "an example value")]
property a_field : String

Defined in:

openapi-generator/serializable.cr