forked from loafle/openapi-generator-original
Generate a ruby-client sample for OpenAPI 2.0 (#1482)
* Move output directory for bin/openapi3/ruby-client-petstore.sh $ git mv sample/client/petstore/ruby sample/openapi3/client/petstore/ruby-client * $ bin/ruby-client-petstore.sh * Run bin/ruby-client-petstore.sh in bin/utils/ensure-up-to-date
This commit is contained in:
committed by
William Cheng
parent
f58bd6d839
commit
b9949e1a8e
@@ -0,0 +1,47 @@
|
||||
=begin
|
||||
#Swagger Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
Swagger Codegen version: 2.3.0-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::AnotherFakeApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'AnotherFakeApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::AnotherFakeApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of AnotherFakeApi' do
|
||||
it 'should create an instance of AnotherFakeApi' do
|
||||
expect(@instance).to be_instance_of(Petstore::AnotherFakeApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_special_tags
|
||||
# To test special tags
|
||||
# To test special tags
|
||||
# @param body client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Client]
|
||||
describe 'test_special_tags test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
=begin
|
||||
#OpenAPI Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
|
||||
Generated by: https://openapi-generator.tech
|
||||
OpenAPI Generator version: 3.3.2-SNAPSHOT
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::DefaultApi
|
||||
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
||||
# Please update as you see appropriate
|
||||
describe 'DefaultApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::DefaultApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of DefaultApi' do
|
||||
it 'should create an instance of DefaultApi' do
|
||||
expect(@instance).to be_instance_of(Petstore::DefaultApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for foo_get
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [InlineResponseDefault]
|
||||
describe 'foo_get test' do
|
||||
it 'should work' do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,62 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::FakeApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'FakeApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::FakeApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of FakeApi' do
|
||||
it 'should create an instance of FakeApi' do
|
||||
expect(@instance).to be_instance_of(Petstore::FakeApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_endpoint_parameters
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
# @param number None
|
||||
# @param double None
|
||||
# @param string None
|
||||
# @param byte None
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [Integer] :integer None
|
||||
# @option opts [Integer] :int32 None
|
||||
# @option opts [Integer] :int64 None
|
||||
# @option opts [Float] :float None
|
||||
# @option opts [String] :binary None
|
||||
# @option opts [Date] :date None
|
||||
# @option opts [DateTime] :date_time None
|
||||
# @option opts [String] :password None
|
||||
# @return [nil]
|
||||
describe 'test_endpoint_parameters test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
=begin
|
||||
#Swagger Petstore
|
||||
|
||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::FakeClassnameTags123Api
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'FakeClassnameTags123Api' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::FakeClassnameTags123Api.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of FakeClassnameTags123Api' do
|
||||
it 'should create an instact of FakeClassnameTags123Api' do
|
||||
expect(@instance).to be_instance_of(Petstore::FakeClassnameTags123Api)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for test_classname
|
||||
# To test class name in snake case
|
||||
#
|
||||
# @param body client model
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Client]
|
||||
describe 'test_classname test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
140
samples/openapi3/client/petstore/ruby/spec/api/pet_api_spec.rb
Normal file
140
samples/openapi3/client/petstore/ruby/spec/api/pet_api_spec.rb
Normal file
@@ -0,0 +1,140 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::PetApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'PetApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::PetApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of PetApi' do
|
||||
it 'should create an instance of PetApi' do
|
||||
expect(@instance).to be_instance_of(Petstore::PetApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for add_pet
|
||||
# Add a new pet to the store
|
||||
#
|
||||
# @param body Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'add_pet test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_pet
|
||||
# Deletes a pet
|
||||
#
|
||||
# @param pet_id Pet id to delete
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :api_key
|
||||
# @return [nil]
|
||||
describe 'delete_pet test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for find_pets_by_status
|
||||
# Finds Pets by status
|
||||
# Multiple status values can be provided with comma separated strings
|
||||
# @param status Status values that need to be considered for filter
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<Pet>]
|
||||
describe 'find_pets_by_status test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for find_pets_by_tags
|
||||
# Finds Pets by tags
|
||||
# Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
# @param tags Tags to filter by
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Array<Pet>]
|
||||
describe 'find_pets_by_tags test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_pet_by_id
|
||||
# Find pet by ID
|
||||
# Returns a single pet
|
||||
# @param pet_id ID of pet to return
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Pet]
|
||||
describe 'get_pet_by_id test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_pet
|
||||
# Update an existing pet
|
||||
#
|
||||
# @param body Pet object that needs to be added to the store
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'update_pet test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_pet_with_form
|
||||
# Updates a pet in the store with form data
|
||||
#
|
||||
# @param pet_id ID of pet that needs to be updated
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :name Updated name of the pet
|
||||
# @option opts [String] :status Updated status of the pet
|
||||
# @return [nil]
|
||||
describe 'update_pet_with_form test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for upload_file
|
||||
# uploads an image
|
||||
#
|
||||
# @param pet_id ID of pet to update
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @option opts [String] :additional_metadata Additional data to pass to server
|
||||
# @option opts [File] :file file to upload
|
||||
# @return [ApiResponse]
|
||||
describe 'upload_file test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,86 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::StoreApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'StoreApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::StoreApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of StoreApi' do
|
||||
it 'should create an instance of StoreApi' do
|
||||
expect(@instance).to be_instance_of(Petstore::StoreApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_order
|
||||
# Delete purchase order by ID
|
||||
# For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
# @param order_id ID of the order that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'delete_order test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_inventory
|
||||
# Returns pet inventories by status
|
||||
# Returns a map of status codes to quantities
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Hash<String, Integer>]
|
||||
describe 'get_inventory test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_order_by_id
|
||||
# Find purchase order by ID
|
||||
# For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
# @param order_id ID of pet that needs to be fetched
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Order]
|
||||
describe 'get_order_by_id test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for place_order
|
||||
# Place an order for a pet
|
||||
#
|
||||
# @param body order placed for purchasing the pet
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [Order]
|
||||
describe 'place_order test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
136
samples/openapi3/client/petstore/ruby/spec/api/user_api_spec.rb
Normal file
136
samples/openapi3/client/petstore/ruby/spec/api/user_api_spec.rb
Normal file
@@ -0,0 +1,136 @@
|
||||
=begin
|
||||
Swagger Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
Contact: apiteam@swagger.io
|
||||
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
|
||||
License: Apache 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
Terms of Service: http://swagger.io/terms/
|
||||
|
||||
=end
|
||||
|
||||
require 'spec_helper'
|
||||
require 'json'
|
||||
|
||||
# Unit tests for Petstore::UserApi
|
||||
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
||||
# Please update as you see appropriate
|
||||
describe 'UserApi' do
|
||||
before do
|
||||
# run before each test
|
||||
@instance = Petstore::UserApi.new
|
||||
end
|
||||
|
||||
after do
|
||||
# run after each test
|
||||
end
|
||||
|
||||
describe 'test an instance of UserApi' do
|
||||
it 'should create an instance of UserApi' do
|
||||
expect(@instance).to be_instance_of(Petstore::UserApi)
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for create_user
|
||||
# Create user
|
||||
# This can only be done by the logged in user.
|
||||
# @param body Created user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'create_user test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for create_users_with_array_input
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param body List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'create_users_with_array_input test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for create_users_with_list_input
|
||||
# Creates list of users with given input array
|
||||
#
|
||||
# @param body List of user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'create_users_with_list_input test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for delete_user
|
||||
# Delete user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username The name that needs to be deleted
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'delete_user test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for get_user_by_name
|
||||
# Get user by user name
|
||||
#
|
||||
# @param username The name that needs to be fetched. Use user1 for testing.
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [User]
|
||||
describe 'get_user_by_name test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for login_user
|
||||
# Logs user into the system
|
||||
#
|
||||
# @param username The user name for login
|
||||
# @param password The password for login in clear text
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [String]
|
||||
describe 'login_user test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for logout_user
|
||||
# Logs out current logged in user session
|
||||
#
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'logout_user test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
# unit tests for update_user
|
||||
# Updated user
|
||||
# This can only be done by the logged in user.
|
||||
# @param username name that need to be deleted
|
||||
# @param body Updated user object
|
||||
# @param [Hash] opts the optional parameters
|
||||
# @return [nil]
|
||||
describe 'update_user test' do
|
||||
it "should work" do
|
||||
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user