Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,24 @@ private static interface OpenAPISchemaVisitor {
}

public static String getSimpleRef(String ref) {
if (ref.startsWith("#/components/")) {
if (ref == null) {
once(LOGGER).warn("Failed to get the schema name: null");
//throw new RuntimeException("Failed to get the schema: null");
return null;
} else if (ref.startsWith("#/components/")) {
ref = ref.substring(ref.lastIndexOf("/") + 1);
} else if (ref.startsWith("#/definitions/")) {
ref = ref.substring(ref.lastIndexOf("/") + 1);
} else {
once(LOGGER).warn("Failed to get the schema name: {}", ref);
//throw new RuntimeException("Failed to get the schema: " + ref);
return null;

}

try {
ref = URLDecoder.decode(ref, "UTF-8");
} catch (UnsupportedEncodingException ignored) {
once(LOGGER).warn("Found UnsupportedEncodingException: {}", ref);
}

// see https://tools.ietf.org/html/rfc6901#section-3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2488,16 +2488,13 @@ components:
propertyName: shapeType
NullableShape:
description: The value may be a shape or the 'null' value.
The 'nullable' attribute was introduced in OAS schema >= 3.0
and has been deprecated in OAS schema >= 3.1.
For a nullable composed schema to work, one of its chosen oneOf schemas must be type null
For a composed schema to validate a null payload,
one of its chosen oneOf schemas must be type null
or nullable (introduced in OAS schema >= 3.0)
oneOf:
- $ref: '#/components/schemas/Triangle'
- $ref: '#/components/schemas/Quadrilateral'
- type: null
discriminator:
propertyName: shapeType
nullable: true
- type: "null"
TriangleInterface:
properties:
shapeType:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<swagger-core.version>2.1.12</swagger-core.version>
<swagger-parser-groupid.version>io.swagger.parser.v3</swagger-parser-groupid.version>
<swagger-parser.version>2.0.26</swagger-parser.version>
<swagger-parser.version>2.0.29</swagger-parser.version>
<testng.version>7.3.0</testng.version>
<violations-maven-plugin.version>1.34</violations-maven-plugin.version>
<wagon-ssh-external.version>3.4.3</wagon-ssh-external.version>
Expand Down
10 changes: 10 additions & 0 deletions samples/client/petstore/crystal/src/petstore/api/pet_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module Petstore
@api_client = api_client
end
# Add a new pet to the store
#
# @param pet [Pet] Pet object that needs to be added to the store
# @return [Pet]
def add_pet(pet : Pet)
Expand All @@ -26,6 +27,7 @@ module Petstore
end

# Add a new pet to the store
#
# @param pet [Pet] Pet object that needs to be added to the store
# @return [Array<(Pet, Integer, Hash)>] Pet data, response status code and response headers
def add_pet_with_http_info(pet : Pet)
Expand Down Expand Up @@ -77,6 +79,7 @@ module Petstore
end

# Deletes a pet
#
# @param pet_id [Int64] Pet id to delete
# @return [nil]
def delete_pet(pet_id : Int64, api_key : String?)
Expand All @@ -85,6 +88,7 @@ module Petstore
end

# Deletes a pet
#
# @param pet_id [Int64] Pet id to delete
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def delete_pet_with_http_info(pet_id : Int64, api_key : String?)
Expand Down Expand Up @@ -312,6 +316,7 @@ module Petstore
end

# Update an existing pet
#
# @param pet [Pet] Pet object that needs to be added to the store
# @return [Pet]
def update_pet(pet : Pet)
Expand All @@ -320,6 +325,7 @@ module Petstore
end

# Update an existing pet
#
# @param pet [Pet] Pet object that needs to be added to the store
# @return [Array<(Pet, Integer, Hash)>] Pet data, response status code and response headers
def update_pet_with_http_info(pet : Pet)
Expand Down Expand Up @@ -371,6 +377,7 @@ module Petstore
end

# Updates a pet in the store with form data
#
# @param pet_id [Int64] ID of pet that needs to be updated
# @return [nil]
def update_pet_with_form(pet_id : Int64, name : String?, status : String?)
Expand All @@ -379,6 +386,7 @@ module Petstore
end

# Updates a pet in the store with form data
#
# @param pet_id [Int64] ID of pet that needs to be updated
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def update_pet_with_form_with_http_info(pet_id : Int64, name : String?, status : String?)
Expand Down Expand Up @@ -430,6 +438,7 @@ module Petstore
end

# uploads an image
#
# @param pet_id [Int64] ID of pet to update
# @return [ApiResponse]
def upload_file(pet_id : Int64, additional_metadata : String?, file : ::File?)
Expand All @@ -438,6 +447,7 @@ module Petstore
end

# uploads an image
#
# @param pet_id [Int64] ID of pet to update
# @return [Array<(ApiResponse, Integer, Hash)>] ApiResponse data, response status code and response headers
def upload_file_with_http_info(pet_id : Int64, additional_metadata : String?, file : ::File?)
Expand Down
2 changes: 2 additions & 0 deletions samples/client/petstore/crystal/src/petstore/api/store_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ module Petstore
end

# Place an order for a pet
#
# @param order [Order] order placed for purchasing the pet
# @return [Order]
def place_order(order : Order)
Expand All @@ -203,6 +204,7 @@ module Petstore
end

# Place an order for a pet
#
# @param order [Order] order placed for purchasing the pet
# @return [Array<(Order, Integer, Hash)>] Order data, response status code and response headers
def place_order_with_http_info(order : Order)
Expand Down
10 changes: 10 additions & 0 deletions samples/client/petstore/crystal/src/petstore/api/user_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ module Petstore
end

# Creates list of users with given input array
#
# @param user [Array(User)] List of user object
# @return [nil]
def create_users_with_array_input(user : Array(User))
Expand All @@ -85,6 +86,7 @@ module Petstore
end

# Creates list of users with given input array
#
# @param user [Array(User)] List of user object
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_users_with_array_input_with_http_info(user : Array(User))
Expand Down Expand Up @@ -134,6 +136,7 @@ module Petstore
end

# Creates list of users with given input array
#
# @param user [Array(User)] List of user object
# @return [nil]
def create_users_with_list_input(user : Array(User))
Expand All @@ -142,6 +145,7 @@ module Petstore
end

# Creates list of users with given input array
#
# @param user [Array(User)] List of user object
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def create_users_with_list_input_with_http_info(user : Array(User))
Expand Down Expand Up @@ -248,6 +252,7 @@ module Petstore
end

# Get user by user name
#
# @param username [String] The name that needs to be fetched. Use user1 for testing.
# @return [User]
def get_user_by_name(username : String)
Expand All @@ -256,6 +261,7 @@ module Petstore
end

# Get user by user name
#
# @param username [String] The name that needs to be fetched. Use user1 for testing.
# @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
def get_user_by_name_with_http_info(username : String)
Expand Down Expand Up @@ -305,6 +311,7 @@ module Petstore
end

# Logs user into the system
#
# @param username [String] The user name for login
# @param password [String] The password for login in clear text
# @return [String]
Expand All @@ -314,6 +321,7 @@ module Petstore
end

# Logs user into the system
#
# @param username [String] The user name for login
# @param password [String] The password for login in clear text
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
Expand Down Expand Up @@ -375,13 +383,15 @@ module Petstore
end

# Logs out current logged in user session
#
# @return [nil]
def logout_user()
logout_user_with_http_info()
nil
end

# Logs out current logged in user session
#
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def logout_user_with_http_info()
if @api_client.config.debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ defmodule OpenapiPetstore.Api.Fake do

@doc """
test inline additionalProperties


## Parameters

Expand All @@ -490,6 +491,7 @@ defmodule OpenapiPetstore.Api.Fake do

@doc """
test json serialization of form data


## Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule OpenapiPetstore.Api.Pet do

@doc """
Add a new pet to the store


## Parameters

Expand Down Expand Up @@ -40,6 +41,7 @@ defmodule OpenapiPetstore.Api.Pet do

@doc """
Deletes a pet


## Parameters

Expand Down Expand Up @@ -155,6 +157,7 @@ defmodule OpenapiPetstore.Api.Pet do

@doc """
Update an existing pet


## Parameters

Expand Down Expand Up @@ -184,6 +187,7 @@ defmodule OpenapiPetstore.Api.Pet do

@doc """
Updates a pet in the store with form data


## Parameters

Expand Down Expand Up @@ -218,6 +222,7 @@ defmodule OpenapiPetstore.Api.Pet do

@doc """
uploads an image


## Parameters

Expand Down Expand Up @@ -251,6 +256,7 @@ defmodule OpenapiPetstore.Api.Pet do

@doc """
uploads an image (required)


## Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ defmodule OpenapiPetstore.Api.Store do

@doc """
Place an order for a pet


## Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ defmodule OpenapiPetstore.Api.User do

@doc """
Creates list of users with given input array


## Parameters

Expand All @@ -66,6 +67,7 @@ defmodule OpenapiPetstore.Api.User do

@doc """
Creates list of users with given input array


## Parameters

Expand Down Expand Up @@ -119,6 +121,7 @@ defmodule OpenapiPetstore.Api.User do

@doc """
Get user by user name


## Parameters

Expand Down Expand Up @@ -146,6 +149,7 @@ defmodule OpenapiPetstore.Api.User do

@doc """
Logs user into the system


## Parameters

Expand Down Expand Up @@ -175,6 +179,7 @@ defmodule OpenapiPetstore.Api.User do

@doc """
Logs out current logged in user session


## Parameters

Expand Down
Loading