All Downloads are FREE. Search and download functionalities are using the official Maven repository.

crystal.partial_oneof_module_doc.mustache Maven / Gradle / Ivy

There is a newer version: 7.6.0
Show newest version
# {{moduleName}}::{{classname}}

## Class instance methods

### `openapi_one_of`

Returns the list of classes defined in oneOf.

#### Example

```ruby
require '{{{gemName}}}'

{{moduleName}}::{{classname}}.openapi_one_of
# =>
{{#oneOf}}
{{#-first}}
# [
{{/-first}}
#   :'{{{.}}}'{{^-last}},{{/-last}}
{{#-last}}
# ]
{{/-last}}
{{/oneOf}}
```
{{#discriminator}}
{{#propertyName}}

### `openapi_discriminator_name`

Returns the discriminator's property name.

#### Example

```ruby
require '{{{gemName}}}'

{{moduleName}}::{{classname}}.openapi_discriminator_name
# => :'{{{.}}}'
```
{{/propertyName}}
{{#mappedModels}}
{{#-first}}

### `openapi_discriminator_name`

Returns the discriminator's mapping.

#### Example

```ruby
require '{{{gemName}}}'

{{moduleName}}::{{classname}}.openapi_discriminator_mapping
# =>
# {
{{/-first}}
#   :'{{{mappingName}}}' => :'{{{modelName}}}'{{^-last}},{{/-last}}
{{#-last}}
# }
{{/-last}}
{{/mappedModels}}
{{/discriminator}}

### build

Find the appropriate object from the `openapi_one_of` list and casts the data into it.

#### Example

```ruby
require '{{{gemName}}}'

{{moduleName}}::{{classname}}.build(data)
# => {{#oneOf}}{{#-first}}#<{{{.}}}:0x00007fdd4aab02a0>{{/-first}}{{/oneOf}}

{{moduleName}}::{{classname}}.build(data_that_doesnt_match)
# => nil
```

#### Parameters

| Name | Type | Description |
| ---- | ---- | ----------- |
| **data** | **Mixed** | data to be matched against the list of oneOf items |

#### Return type

{{#oneOf}}
- `{{{.}}}`
{{/oneOf}}
- `nil` (if no type matches)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy