forked from loafle/openapi-generator-original
[crystal][client] some fix and minor improvement (#9416)
* [crystal][client] remove redundant include JSON::Serializable * [crystal][client] fix syntax error * [crystal][client] fix shard name * [crystal][client] add 'require "json"' * [crystal][client] update sample projects
This commit is contained in:
parent
ae2423e64a
commit
1751aa7272
@ -197,44 +197,44 @@ module {{moduleName}}
|
|||||||
|
|
||||||
# Returns Auth Settings hash for api client.
|
# Returns Auth Settings hash for api client.
|
||||||
def auth_settings
|
def auth_settings
|
||||||
Hash{ {{#authMethods}}{{#isApiKey}}"{{name}}" => {
|
Hash{
|
||||||
type: "api_key",
|
{{#authMethods}}
|
||||||
in: {{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}},
|
{{#isApiKey}}
|
||||||
key: "{{keyParamName}}",
|
"{{name}}" => {
|
||||||
value: api_key_with_prefix("{{keyParamName}}")
|
type: "api_key",
|
||||||
},
|
in: {{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{#isKeyInQuery}}"query"{{/isKeyInQuery}},
|
||||||
|
key: "{{keyParamName}}",
|
||||||
|
value: api_key_with_prefix("{{keyParamName}}")
|
||||||
|
},
|
||||||
{{/isApiKey}}
|
{{/isApiKey}}
|
||||||
{{#isBasic}}
|
{{#isBasic}}
|
||||||
{{#isBasicBasic}}
|
{{#isBasicBasic}}
|
||||||
"{{name}}" =>
|
"{{name}}" => {
|
||||||
{
|
type: "basic",
|
||||||
type: "basic",
|
in: "header",
|
||||||
in: "header",
|
key: "Authorization",
|
||||||
key: "Authorization",
|
value: basic_auth_token
|
||||||
value: basic_auth_token
|
},
|
||||||
},
|
|
||||||
{{/isBasicBasic}}
|
{{/isBasicBasic}}
|
||||||
{{#isBasicBearer}}
|
{{#isBasicBearer}}
|
||||||
"{{name}}" =>
|
"{{name}}" => {
|
||||||
{
|
type: "bearer",
|
||||||
type: "bearer",
|
in: "header",
|
||||||
in: "header",
|
{{#bearerFormat}}
|
||||||
{{#bearerFormat}}
|
format: "{{{.}}}",
|
||||||
format: "{{{.}}}",
|
{{/bearerFormat}}
|
||||||
{{/bearerFormat}}
|
key: "Authorization",
|
||||||
key: "Authorization",
|
value: "Bearer #{access_token}"
|
||||||
value: "Bearer #{access_token}"
|
},
|
||||||
},
|
|
||||||
{{/isBasicBearer}}
|
{{/isBasicBearer}}
|
||||||
{{/isBasic}}
|
{{/isBasic}}
|
||||||
{{#isOAuth}}
|
{{#isOAuth}}
|
||||||
"{{name}}" =>
|
"{{name}}" => {
|
||||||
{
|
type: "oauth2",
|
||||||
type: "oauth2",
|
in: "header",
|
||||||
in: "header",
|
key: "Authorization",
|
||||||
key: "Authorization",
|
value: "Bearer #{access_token}"
|
||||||
value: "Bearer #{access_token}"
|
},
|
||||||
},
|
|
||||||
{{/isOAuth}}
|
{{/isOAuth}}
|
||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}}
|
# {{#lambdaPrefixWithHash}}{{> api_info}}{{/lambdaPrefixWithHash}}
|
||||||
|
|
||||||
|
require "json"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
module {{moduleName}}
|
module {{moduleName}}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
{{#description}}
|
{{#description}}
|
||||||
# {{{description}}}
|
# {{{description}}}
|
||||||
{{/description}}
|
{{/description}}
|
||||||
class {{classname}}{{#parent}} < {{{.}}}{{/parent}} include JSON::Serializable
|
class {{classname}}{{#parent}} < {{{.}}}{{/parent}}
|
||||||
include JSON::Serializable {{#vars}}
|
include JSON::Serializable
|
||||||
|
|
||||||
|
{{#vars}}
|
||||||
{{#description}}
|
{{#description}}
|
||||||
# {{{description}}}
|
# {{{description}}}
|
||||||
{{/description}}
|
{{/description}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: {{{moduleName}}}
|
name: {{{shardName}}}
|
||||||
version: {{{shardVersion}}}
|
version: {{{shardVersion}}}
|
||||||
authors:
|
authors:
|
||||||
- {{{shardAuthors}}}
|
- {{{shardAuthors}}}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: Petstore
|
name: petstore
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
authors:
|
authors:
|
||||||
-
|
-
|
||||||
|
@ -205,19 +205,19 @@ module Petstore
|
|||||||
|
|
||||||
# Returns Auth Settings hash for api client.
|
# Returns Auth Settings hash for api client.
|
||||||
def auth_settings
|
def auth_settings
|
||||||
Hash{ "api_key" => {
|
Hash{
|
||||||
type: "api_key",
|
"api_key" => {
|
||||||
in: "header",
|
type: "api_key",
|
||||||
key: "api_key",
|
in: "header",
|
||||||
value: api_key_with_prefix("api_key")
|
key: "api_key",
|
||||||
},
|
value: api_key_with_prefix("api_key")
|
||||||
"petstore_auth" =>
|
},
|
||||||
{
|
"petstore_auth" => {
|
||||||
type: "oauth2",
|
type: "oauth2",
|
||||||
in: "header",
|
in: "header",
|
||||||
key: "Authorization",
|
key: "Authorization",
|
||||||
value: "Bearer #{access_token}"
|
value: "Bearer #{access_token}"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -8,20 +8,20 @@
|
|||||||
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
require "json"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
# Describes the result of uploading an image resource
|
# Describes the result of uploading an image resource
|
||||||
class ApiResponse include JSON::Serializable
|
class ApiResponse
|
||||||
include JSON::Serializable
|
include JSON::Serializable
|
||||||
|
|
||||||
@[JSON::Field(key: code, type: Int32)]
|
@[JSON::Field(key: code, type: Int32)]
|
||||||
property code : Int32
|
property code : Int32
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: type, type: String)]
|
@[JSON::Field(key: type, type: String)]
|
||||||
property _type : String
|
property _type : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: message, type: String)]
|
@[JSON::Field(key: message, type: String)]
|
||||||
property message : String
|
property message : String
|
||||||
|
|
||||||
|
@ -8,16 +8,17 @@
|
|||||||
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
require "json"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
# A category for a pet
|
# A category for a pet
|
||||||
class Category include JSON::Serializable
|
class Category
|
||||||
include JSON::Serializable
|
include JSON::Serializable
|
||||||
|
|
||||||
@[JSON::Field(key: id, type: Int64)]
|
@[JSON::Field(key: id, type: Int64)]
|
||||||
property id : Int64
|
property id : Int64
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: name, type: String)]
|
@[JSON::Field(key: name, type: String)]
|
||||||
property name : String
|
property name : String
|
||||||
|
|
||||||
|
@ -8,33 +8,30 @@
|
|||||||
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
require "json"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
# An order for a pets from the pet store
|
# An order for a pets from the pet store
|
||||||
class Order include JSON::Serializable
|
class Order
|
||||||
include JSON::Serializable
|
include JSON::Serializable
|
||||||
|
|
||||||
@[JSON::Field(key: id, type: Int64)]
|
@[JSON::Field(key: id, type: Int64)]
|
||||||
property id : Int64
|
property id : Int64
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: petId, type: Int64)]
|
@[JSON::Field(key: petId, type: Int64)]
|
||||||
property pet_id : Int64
|
property pet_id : Int64
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: quantity, type: Int32)]
|
@[JSON::Field(key: quantity, type: Int32)]
|
||||||
property quantity : Int32
|
property quantity : Int32
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: shipDate, type: Time)]
|
@[JSON::Field(key: shipDate, type: Time)]
|
||||||
property ship_date : Time
|
property ship_date : Time
|
||||||
|
|
||||||
|
|
||||||
# Order Status
|
# Order Status
|
||||||
@[JSON::Field(key: status, type: String)]
|
@[JSON::Field(key: status, type: String)]
|
||||||
property status : String
|
property status : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: complete, type: Bool)]
|
@[JSON::Field(key: complete, type: Bool)]
|
||||||
property complete : Bool
|
property complete : Bool
|
||||||
|
|
||||||
|
@ -8,32 +8,29 @@
|
|||||||
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
require "json"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
# A pet for sale in the pet store
|
# A pet for sale in the pet store
|
||||||
class Pet include JSON::Serializable
|
class Pet
|
||||||
include JSON::Serializable
|
include JSON::Serializable
|
||||||
|
|
||||||
@[JSON::Field(key: id, type: Int64)]
|
@[JSON::Field(key: id, type: Int64)]
|
||||||
property id : Int64
|
property id : Int64
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: category, type: Category)]
|
@[JSON::Field(key: category, type: Category)]
|
||||||
property category : Category
|
property category : Category
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: name, type: String)]
|
@[JSON::Field(key: name, type: String)]
|
||||||
property name : String
|
property name : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: photoUrls, type: Array(String))]
|
@[JSON::Field(key: photoUrls, type: Array(String))]
|
||||||
property photo_urls : Array(String)
|
property photo_urls : Array(String)
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: tags, type: Array(Tag))]
|
@[JSON::Field(key: tags, type: Array(Tag))]
|
||||||
property tags : Array(Tag)
|
property tags : Array(Tag)
|
||||||
|
|
||||||
|
|
||||||
# pet status in the store
|
# pet status in the store
|
||||||
@[JSON::Field(key: status, type: String)]
|
@[JSON::Field(key: status, type: String)]
|
||||||
property status : String
|
property status : String
|
||||||
|
@ -8,16 +8,17 @@
|
|||||||
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
require "json"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
# A tag for a pet
|
# A tag for a pet
|
||||||
class Tag include JSON::Serializable
|
class Tag
|
||||||
include JSON::Serializable
|
include JSON::Serializable
|
||||||
|
|
||||||
@[JSON::Field(key: id, type: Int64)]
|
@[JSON::Field(key: id, type: Int64)]
|
||||||
property id : Int64
|
property id : Int64
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: name, type: String)]
|
@[JSON::Field(key: name, type: String)]
|
||||||
property name : String
|
property name : String
|
||||||
|
|
||||||
|
@ -8,40 +8,35 @@
|
|||||||
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
#OpenAPI Generator version: 5.2.0-SNAPSHOT
|
||||||
#
|
#
|
||||||
|
|
||||||
|
require "json"
|
||||||
require "time"
|
require "time"
|
||||||
|
|
||||||
module Petstore
|
module Petstore
|
||||||
# A User who is purchasing from the pet store
|
# A User who is purchasing from the pet store
|
||||||
class User include JSON::Serializable
|
class User
|
||||||
include JSON::Serializable
|
include JSON::Serializable
|
||||||
|
|
||||||
@[JSON::Field(key: id, type: Int64)]
|
@[JSON::Field(key: id, type: Int64)]
|
||||||
property id : Int64
|
property id : Int64
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: username, type: String)]
|
@[JSON::Field(key: username, type: String)]
|
||||||
property username : String
|
property username : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: firstName, type: String)]
|
@[JSON::Field(key: firstName, type: String)]
|
||||||
property first_name : String
|
property first_name : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: lastName, type: String)]
|
@[JSON::Field(key: lastName, type: String)]
|
||||||
property last_name : String
|
property last_name : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: email, type: String)]
|
@[JSON::Field(key: email, type: String)]
|
||||||
property email : String
|
property email : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: password, type: String)]
|
@[JSON::Field(key: password, type: String)]
|
||||||
property password : String
|
property password : String
|
||||||
|
|
||||||
|
|
||||||
@[JSON::Field(key: phone, type: String)]
|
@[JSON::Field(key: phone, type: String)]
|
||||||
property phone : String
|
property phone : String
|
||||||
|
|
||||||
|
|
||||||
# User Status
|
# User Status
|
||||||
@[JSON::Field(key: userStatus, type: Int32)]
|
@[JSON::Field(key: userStatus, type: Int32)]
|
||||||
property user_status : Int32
|
property user_status : Int32
|
||||||
|
Loading…
x
Reference in New Issue
Block a user