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