forked from loafle/openapi-generator-original
[Julia] Fix error in server enum generation (#16079)
Fixed issue in enum generation for julia-server code. An empty struct was generated, where it should have generated a type alias.
This commit is contained in:
parent
ec6381295a
commit
c595a02b61
@ -2,15 +2,14 @@
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
{{#isAlias}}
|
||||
if !isdefined(@__MODULE__, :{{classname}})
|
||||
const {{classname}} = {{dataType}}
|
||||
else
|
||||
@warn("Skipping redefinition of {{classname}} to {{dataType}}")
|
||||
end
|
||||
{{>partial_model_alias}}
|
||||
{{/isAlias}}{{^isAlias}}{{#oneOf}}{{#-first}}
|
||||
{{>partial_model_oneof}}
|
||||
{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}
|
||||
{{>partial_model_anyof}}
|
||||
{{/-first}}{{/anyOf}}{{^anyOf}}
|
||||
{{/-first}}{{/anyOf}}{{^anyOf}}{{#hasVars}}
|
||||
{{>partial_model_single}}
|
||||
{{/hasVars}}{{^hasVars}}
|
||||
{{>partial_model_alias}}
|
||||
{{/hasVars}}
|
||||
{{/anyOf}}{{/oneOf}}{{/isAlias}}{{/model}}{{/models}}
|
5
modules/openapi-generator/src/main/resources/julia-server/partial_model_alias.mustache
vendored
Normal file
5
modules/openapi-generator/src/main/resources/julia-server/partial_model_alias.mustache
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
if !isdefined(@__MODULE__, :{{classname}})
|
||||
const {{classname}} = {{dataType}}
|
||||
else
|
||||
@warn("Skipping redefinition of {{classname}} to {{dataType}}")
|
||||
end
|
@ -1,6 +1,6 @@
|
||||
{{#anyOf}}{{#-first}}
|
||||
@doc raw"""{{#description}}{{description}}
|
||||
{{/description}}
|
||||
@doc raw"""{{name}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
{{classname}}(; value=nothing)
|
||||
"""
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#oneOf}}{{#-first}}
|
||||
@doc raw"""{{#description}}{{description}}
|
||||
{{/description}}
|
||||
@doc raw"""{{name}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
{{classname}}(; value=nothing)
|
||||
"""
|
||||
|
@ -1,5 +1,5 @@
|
||||
@doc raw"""{{#description}}{{description}}
|
||||
{{/description}}
|
||||
@doc raw"""{{name}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
{{classname}}(;
|
||||
{{#allVars}}
|
||||
@ -40,7 +40,7 @@ function OpenAPI.validate_property(::Type{ {{classname}} }, name::Symbol, val)
|
||||
{{#allVars}}
|
||||
{{#isEnum}}
|
||||
if name === Symbol("{{#lambda.escapeDollar}}{{baseName}}{{/lambda.escapeDollar}}")
|
||||
OpenAPI.validate_param(name, "{{classname}}", :enum, val, [{{#allowableValues}}{{#values}}{{#isString}}"{{{this}}}"{{/isString}}{{^isString}}{{{this}}}{{/isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}])
|
||||
OpenAPI.validate_param(name, "{{classname}}", :enum, val, [{{#_enum}}{{#isString}}"{{.}}"{{/isString}}{{^isString}}{{.}}{{/isString}}{{^-last}}, {{/-last}}{{/_enum}}])
|
||||
end
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
|
@ -2,7 +2,8 @@
|
||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||
|
||||
|
||||
@doc raw"""Describes the result of uploading an image resource
|
||||
@doc raw"""ApiResponse
|
||||
Describes the result of uploading an image resource
|
||||
|
||||
ApiResponse(;
|
||||
code=nothing,
|
||||
|
@ -2,7 +2,8 @@
|
||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||
|
||||
|
||||
@doc raw"""A category for a pet
|
||||
@doc raw"""Category
|
||||
A category for a pet
|
||||
|
||||
Category(;
|
||||
id=nothing,
|
||||
|
@ -2,7 +2,8 @@
|
||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||
|
||||
|
||||
@doc raw"""An order for a pets from the pet store
|
||||
@doc raw"""Order
|
||||
An order for a pets from the pet store
|
||||
|
||||
Order(;
|
||||
id=nothing,
|
||||
|
@ -2,7 +2,8 @@
|
||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||
|
||||
|
||||
@doc raw"""A pet for sale in the pet store
|
||||
@doc raw"""Pet
|
||||
A pet for sale in the pet store
|
||||
|
||||
Pet(;
|
||||
id=nothing,
|
||||
|
@ -2,7 +2,8 @@
|
||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||
|
||||
|
||||
@doc raw"""A tag for a pet
|
||||
@doc raw"""Tag
|
||||
A tag for a pet
|
||||
|
||||
Tag(;
|
||||
id=nothing,
|
||||
|
@ -2,7 +2,8 @@
|
||||
# Do not modify this file directly. Modify the OpenAPI specification instead.
|
||||
|
||||
|
||||
@doc raw"""A User who is purchasing from the pet store
|
||||
@doc raw"""User
|
||||
A User who is purchasing from the pet store
|
||||
|
||||
User(;
|
||||
id=nothing,
|
||||
|
Loading…
x
Reference in New Issue
Block a user