[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:
Tanmay Mohapatra 2023-07-12 16:34:30 +05:30 committed by GitHub
parent ec6381295a
commit c595a02b61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 29 additions and 19 deletions

View File

@ -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}}

View File

@ -0,0 +1,5 @@
if !isdefined(@__MODULE__, :{{classname}})
const {{classname}} = {{dataType}}
else
@warn("Skipping redefinition of {{classname}} to {{dataType}}")
end

View File

@ -1,6 +1,6 @@
{{#anyOf}}{{#-first}}
@doc raw"""{{#description}}{{description}}
{{/description}}
@doc raw"""{{name}}{{#description}}
{{description}}{{/description}}
{{classname}}(; value=nothing)
"""

View File

@ -1,6 +1,6 @@
{{#oneOf}}{{#-first}}
@doc raw"""{{#description}}{{description}}
{{/description}}
@doc raw"""{{name}}{{#description}}
{{description}}{{/description}}
{{classname}}(; value=nothing)
"""

View File

@ -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}}

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,