-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmodel_Dog.jl
More file actions
51 lines (38 loc) · 1.43 KB
/
model_Dog.jl
File metadata and controls
51 lines (38 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This file was generated by the Julia OpenAPI Code Generator
# Do not modify this file directly. Modify the OpenAPI specification instead.
@doc raw"""Dog
Dog(;
pet_type=nothing,
bark=nothing,
breed=nothing,
)
- pet_type::String
- bark::Bool
- breed::String
"""
Base.@kwdef mutable struct Dog <: OpenAPI.APIModel
pet_type::Union{Nothing, String} = nothing
bark::Union{Nothing, Bool} = nothing
breed::Union{Nothing, String} = nothing
function Dog(pet_type, bark, breed, )
o = new(pet_type, bark, breed, )
OpenAPI.validate_properties(o)
return o
end
end # type Dog
const _property_types_Dog = Dict{Symbol,String}(Symbol("pet_type")=>"String", Symbol("bark")=>"Bool", Symbol("breed")=>"String", )
OpenAPI.property_type(::Type{ Dog }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_Dog[name]))}
function OpenAPI.check_required(o::Dog)
o.pet_type === nothing && (return false)
true
end
function OpenAPI.validate_properties(o::Dog)
OpenAPI.validate_property(Dog, Symbol("pet_type"), o.pet_type)
OpenAPI.validate_property(Dog, Symbol("bark"), o.bark)
OpenAPI.validate_property(Dog, Symbol("breed"), o.breed)
end
function OpenAPI.validate_property(::Type{ Dog }, name::Symbol, val)
if name === Symbol("breed")
OpenAPI.validate_param(name, "Dog", :enum, val, ["Dingo", "Husky", "Retriever", "Shepherd"])
end
end