From 6722f1300d38e94f302d41ee441c9a68395e51d3 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Thu, 5 Oct 2023 12:55:57 +0800 Subject: [PATCH] add ruby httpx echo api tests (#16729) --- bin/configs/ruby-httpx-echo-api.yaml | 7 + samples/client/echo_api/ruby-httpx/.gitignore | 39 ++ .../client/echo_api/ruby-httpx/.gitlab-ci.yml | 26 + .../ruby-httpx/.openapi-generator-ignore | 23 + .../ruby-httpx/.openapi-generator/FILES | 52 ++ .../ruby-httpx/.openapi-generator/VERSION | 1 + samples/client/echo_api/ruby-httpx/.rspec | 2 + .../client/echo_api/ruby-httpx/.rubocop.yml | 148 +++++ .../client/echo_api/ruby-httpx/.travis.yml | 11 + samples/client/echo_api/ruby-httpx/Gemfile | 9 + samples/client/echo_api/ruby-httpx/README.md | 130 +++++ samples/client/echo_api/ruby-httpx/Rakefile | 10 + .../echo_api/ruby-httpx/docs/AuthApi.md | 75 +++ .../client/echo_api/ruby-httpx/docs/Bird.md | 20 + .../echo_api/ruby-httpx/docs/BodyApi.md | 469 +++++++++++++++ .../echo_api/ruby-httpx/docs/Category.md | 20 + .../echo_api/ruby-httpx/docs/DataQuery.md | 22 + .../echo_api/ruby-httpx/docs/DefaultValue.md | 32 + .../echo_api/ruby-httpx/docs/FormApi.md | 155 +++++ .../echo_api/ruby-httpx/docs/HeaderApi.md | 78 +++ .../ruby-httpx/docs/NumberPropertiesOnly.md | 22 + .../echo_api/ruby-httpx/docs/PathApi.md | 74 +++ .../client/echo_api/ruby-httpx/docs/Pet.md | 28 + .../client/echo_api/ruby-httpx/docs/Query.md | 20 + .../echo_api/ruby-httpx/docs/QueryApi.md | 551 ++++++++++++++++++ .../echo_api/ruby-httpx/docs/StringEnumRef.md | 15 + .../client/echo_api/ruby-httpx/docs/Tag.md | 20 + ...lodeTrueObjectAllOfQueryObjectParameter.md | 24 + ...lodeTrueArrayStringQueryObjectParameter.md | 18 + .../client/echo_api/ruby-httpx/git_push.sh | 57 ++ .../echo_api/ruby-httpx/lib/openapi_client.rb | 56 ++ .../lib/openapi_client/api/auth_api.rb | 79 +++ .../lib/openapi_client/api/body_api.rb | 468 +++++++++++++++ .../lib/openapi_client/api/form_api.rb | 173 ++++++ .../lib/openapi_client/api/header_api.rb | 88 +++ .../lib/openapi_client/api/path_api.rb | 91 +++ .../lib/openapi_client/api/query_api.rb | 514 ++++++++++++++++ .../lib/openapi_client/api_client.rb | 375 ++++++++++++ .../lib/openapi_client/api_error.rb | 58 ++ .../lib/openapi_client/configuration.rb | 285 +++++++++ .../lib/openapi_client/models/bird.rb | 223 +++++++ .../lib/openapi_client/models/category.rb | 223 +++++++ .../lib/openapi_client/models/data_query.rb | 268 +++++++++ .../openapi_client/models/default_value.rb | 317 ++++++++++ .../models/number_properties_only.rb | 260 +++++++++ .../lib/openapi_client/models/pet.rb | 312 ++++++++++ .../lib/openapi_client/models/query.rb | 248 ++++++++ .../openapi_client/models/string_enum_ref.rb | 41 ++ .../lib/openapi_client/models/tag.rb | 223 +++++++ ...ue_object_all_of_query_object_parameter.rb | 249 ++++++++ ...rue_array_string_query_object_parameter.rb | 216 +++++++ .../ruby-httpx/lib/openapi_client/version.rb | 15 + .../ruby-httpx/openapi_client.gemspec | 38 ++ .../ruby-httpx/spec/api/auth_api_spec.rb | 46 ++ .../ruby-httpx/spec/api/body_api_spec.rb | 118 ++++ .../ruby-httpx/spec/api/form_api_spec.rb | 66 +++ .../ruby-httpx/spec/api/header_api_spec.rb | 49 ++ .../ruby-httpx/spec/api/path_api_spec.rb | 48 ++ .../ruby-httpx/spec/api/query_api_spec.rb | 135 +++++ .../ruby-httpx/spec/api_client_spec.rb | 190 ++++++ .../ruby-httpx/spec/configuration_spec.rb | 75 +++ .../ruby-httpx/spec/models/bird_spec.rb | 42 ++ .../ruby-httpx/spec/models/category_spec.rb | 42 ++ .../ruby-httpx/spec/models/data_query_spec.rb | 48 ++ .../spec/models/default_value_spec.rb | 82 +++ .../models/number_properties_only_spec.rb | 48 ++ .../ruby-httpx/spec/models/pet_spec.rb | 70 +++ .../ruby-httpx/spec/models/query_spec.rb | 46 ++ .../spec/models/string_enum_ref_spec.rb | 30 + .../ruby-httpx/spec/models/tag_spec.rb | 42 ++ ...ject_all_of_query_object_parameter_spec.rb | 54 ++ ...rray_string_query_object_parameter_spec.rb | 36 ++ .../echo_api/ruby-httpx/spec/spec_helper.rb | 111 ++++ 73 files changed, 8356 insertions(+) create mode 100644 bin/configs/ruby-httpx-echo-api.yaml create mode 100644 samples/client/echo_api/ruby-httpx/.gitignore create mode 100644 samples/client/echo_api/ruby-httpx/.gitlab-ci.yml create mode 100644 samples/client/echo_api/ruby-httpx/.openapi-generator-ignore create mode 100644 samples/client/echo_api/ruby-httpx/.openapi-generator/FILES create mode 100644 samples/client/echo_api/ruby-httpx/.openapi-generator/VERSION create mode 100644 samples/client/echo_api/ruby-httpx/.rspec create mode 100644 samples/client/echo_api/ruby-httpx/.rubocop.yml create mode 100644 samples/client/echo_api/ruby-httpx/.travis.yml create mode 100644 samples/client/echo_api/ruby-httpx/Gemfile create mode 100644 samples/client/echo_api/ruby-httpx/README.md create mode 100644 samples/client/echo_api/ruby-httpx/Rakefile create mode 100644 samples/client/echo_api/ruby-httpx/docs/AuthApi.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/Bird.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/BodyApi.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/Category.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/DataQuery.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/DefaultValue.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/FormApi.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/HeaderApi.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/NumberPropertiesOnly.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/PathApi.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/Pet.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/Query.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/QueryApi.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/StringEnumRef.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/Tag.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md create mode 100644 samples/client/echo_api/ruby-httpx/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md create mode 100644 samples/client/echo_api/ruby-httpx/git_push.sh create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/api_error.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/configuration.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/string_enum_ref.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb create mode 100644 samples/client/echo_api/ruby-httpx/lib/openapi_client/version.rb create mode 100644 samples/client/echo_api/ruby-httpx/openapi_client.gemspec create mode 100644 samples/client/echo_api/ruby-httpx/spec/api/auth_api_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/api/body_api_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/api/form_api_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/api/header_api_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/api/path_api_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/api/query_api_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/api_client_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/configuration_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/bird_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/category_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/data_query_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/default_value_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/number_properties_only_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/pet_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/query_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/string_enum_ref_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/tag_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/models/test_query_style_form_explode_true_array_string_query_object_parameter_spec.rb create mode 100644 samples/client/echo_api/ruby-httpx/spec/spec_helper.rb diff --git a/bin/configs/ruby-httpx-echo-api.yaml b/bin/configs/ruby-httpx-echo-api.yaml new file mode 100644 index 00000000000..f145b27192a --- /dev/null +++ b/bin/configs/ruby-httpx-echo-api.yaml @@ -0,0 +1,7 @@ +generatorName: ruby +outputDir: samples/client/echo_api/ruby-httpx +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/ruby-client +library: httpx +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/samples/client/echo_api/ruby-httpx/.gitignore b/samples/client/echo_api/ruby-httpx/.gitignore new file mode 100644 index 00000000000..05a17cb8f0a --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/samples/client/echo_api/ruby-httpx/.gitlab-ci.yml b/samples/client/echo_api/ruby-httpx/.gitlab-ci.yml new file mode 100644 index 00000000000..3a253c45c05 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.gitlab-ci.yml @@ -0,0 +1,26 @@ +.ruby: &ruby + variables: + LANG: "C.UTF-8" + before_script: + - ruby -v + - bundle config set --local deployment true + - bundle install -j $(nproc) + parallel: + matrix: + - RUBY_VERSION: ['2.7', '3.0', '3.1'] + image: "ruby:$RUBY_VERSION" + cache: + paths: + - vendor/ruby + key: 'ruby-$RUBY_VERSION' + +gem: + extends: .ruby + script: + - bundle exec rspec + - bundle exec rake build + - bundle exec rake install + artifacts: + paths: + - pkg/*.gem + diff --git a/samples/client/echo_api/ruby-httpx/.openapi-generator-ignore b/samples/client/echo_api/ruby-httpx/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES b/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES new file mode 100644 index 00000000000..ecf4fd0bbcd --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.openapi-generator/FILES @@ -0,0 +1,52 @@ +.gitignore +.gitlab-ci.yml +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/AuthApi.md +docs/Bird.md +docs/BodyApi.md +docs/Category.md +docs/DataQuery.md +docs/DefaultValue.md +docs/FormApi.md +docs/HeaderApi.md +docs/NumberPropertiesOnly.md +docs/PathApi.md +docs/Pet.md +docs/Query.md +docs/QueryApi.md +docs/StringEnumRef.md +docs/Tag.md +docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md +docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +git_push.sh +lib/openapi_client.rb +lib/openapi_client/api/auth_api.rb +lib/openapi_client/api/body_api.rb +lib/openapi_client/api/form_api.rb +lib/openapi_client/api/header_api.rb +lib/openapi_client/api/path_api.rb +lib/openapi_client/api/query_api.rb +lib/openapi_client/api_client.rb +lib/openapi_client/api_error.rb +lib/openapi_client/configuration.rb +lib/openapi_client/models/bird.rb +lib/openapi_client/models/category.rb +lib/openapi_client/models/data_query.rb +lib/openapi_client/models/default_value.rb +lib/openapi_client/models/number_properties_only.rb +lib/openapi_client/models/pet.rb +lib/openapi_client/models/query.rb +lib/openapi_client/models/string_enum_ref.rb +lib/openapi_client/models/tag.rb +lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb +lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb +lib/openapi_client/version.rb +openapi_client.gemspec +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/spec_helper.rb diff --git a/samples/client/echo_api/ruby-httpx/.openapi-generator/VERSION b/samples/client/echo_api/ruby-httpx/.openapi-generator/VERSION new file mode 100644 index 00000000000..40e36364ab2 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/ruby-httpx/.rspec b/samples/client/echo_api/ruby-httpx/.rspec new file mode 100644 index 00000000000..83e16f80447 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/samples/client/echo_api/ruby-httpx/.rubocop.yml b/samples/client/echo_api/ruby-httpx/.rubocop.yml new file mode 100644 index 00000000000..d32b2b1cdab --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.rubocop.yml @@ -0,0 +1,148 @@ +# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) +# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) +AllCops: + TargetRubyVersion: 2.4 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' + +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true + +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstArgumentIndentation: + Enabled: true + +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: + Enabled: false + +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: indented_internal_methods + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: false + EnforcedStyle: always + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +# Check quotes usage according to lint rule below. +#Style/StringLiterals: +# Enabled: true +# EnforcedStyle: single_quotes + +# Detect hard tabs, no hard tabs. +Layout/IndentationStyle: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingEmptyLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: + Enabled: false + +# Use quotes for string literals when they are enough. +Style/RedundantPercentQ: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Layout/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true diff --git a/samples/client/echo_api/ruby-httpx/.travis.yml b/samples/client/echo_api/ruby-httpx/.travis.yml new file mode 100644 index 00000000000..ef5d971f6be --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/.travis.yml @@ -0,0 +1,11 @@ +language: ruby +cache: bundler +rvm: + - 2.7 + - 3.0 + - 3.1 +script: + - bundle install --path vendor/bundle + - bundle exec rspec + - gem build openapi_client.gemspec + - gem install ./openapi_client-1.0.0.gem diff --git a/samples/client/echo_api/ruby-httpx/Gemfile b/samples/client/echo_api/ruby-httpx/Gemfile new file mode 100644 index 00000000000..c2e3127cdcf --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/Gemfile @@ -0,0 +1,9 @@ +source 'https://rubygems.org' + +gemspec + +group :development, :test do + gem 'rake', '~> 13.0.1' + gem 'pry-byebug' + gem 'rubocop', '~> 0.66.0' +end diff --git a/samples/client/echo_api/ruby-httpx/README.md b/samples/client/echo_api/ruby-httpx/README.md new file mode 100644 index 00000000000..1fcc844b792 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/README.md @@ -0,0 +1,130 @@ +# openapi_client + +OpenapiClient - the Ruby gem for the Echo Server API + +Echo Server API + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build openapi_client.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./openapi_client-1.0.0.gem +``` + +(for development, run `gem install --dev ./openapi_client-1.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'openapi_client', '~> 1.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'openapi_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'openapi_client' + +# Setup authorization +OpenapiClient.configure do |config| + # Configure HTTP basic authorization: http_auth + config.username = 'YOUR_USERNAME' + config.password = 'YOUR_PASSWORD' + # Configure httpx session + config.configure_session { |session| 'YOUR CONNECTION CONFIG PROC' } +end + +api_instance = OpenapiClient::AuthApi.new + +begin + #To test HTTP basic authentication + result = api_instance.test_auth_http_basic + p result +rescue OpenapiClient::ApiError => e + puts "Exception when calling AuthApi->test_auth_http_basic: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*OpenapiClient::AuthApi* | [**test_auth_http_basic**](docs/AuthApi.md#test_auth_http_basic) | **POST** /auth/http/basic | To test HTTP basic authentication +*OpenapiClient::BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body +*OpenapiClient::BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +*OpenapiClient::BodyApi* | [**test_body_multipart_formdata_array_of_binary**](docs/BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +*OpenapiClient::BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +*OpenapiClient::BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s) +*OpenapiClient::BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body +*OpenapiClient::BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) +*OpenapiClient::FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*OpenapiClient::FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema +*OpenapiClient::HeaderApi* | [**test_header_integer_boolean_string**](docs/HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s) +*OpenapiClient::PathApi* | [**tests_path_string_path_string_integer_path_integer**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) +*OpenapiClient::QueryApi* | [**test_enum_ref_string**](docs/QueryApi.md#test_enum_ref_string) | **GET** /query/enum_ref_string | Test query parameter(s) +*OpenapiClient::QueryApi* | [**test_query_datetime_date_string**](docs/QueryApi.md#test_query_datetime_date_string) | **GET** /query/datetime/date/string | Test query parameter(s) +*OpenapiClient::QueryApi* | [**test_query_integer_boolean_string**](docs/QueryApi.md#test_query_integer_boolean_string) | **GET** /query/integer/boolean/string | Test query parameter(s) +*OpenapiClient::QueryApi* | [**test_query_style_deep_object_explode_true_object**](docs/QueryApi.md#test_query_style_deep_object_explode_true_object) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +*OpenapiClient::QueryApi* | [**test_query_style_deep_object_explode_true_object_all_of**](docs/QueryApi.md#test_query_style_deep_object_explode_true_object_all_of) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +*OpenapiClient::QueryApi* | [**test_query_style_form_explode_true_array_string**](docs/QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +*OpenapiClient::QueryApi* | [**test_query_style_form_explode_true_object**](docs/QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +*OpenapiClient::QueryApi* | [**test_query_style_form_explode_true_object_all_of**](docs/QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + +## Documentation for Models + + - [OpenapiClient::Bird](docs/Bird.md) + - [OpenapiClient::Category](docs/Category.md) + - [OpenapiClient::DataQuery](docs/DataQuery.md) + - [OpenapiClient::DefaultValue](docs/DefaultValue.md) + - [OpenapiClient::NumberPropertiesOnly](docs/NumberPropertiesOnly.md) + - [OpenapiClient::Pet](docs/Pet.md) + - [OpenapiClient::Query](docs/Query.md) + - [OpenapiClient::StringEnumRef](docs/StringEnumRef.md) + - [OpenapiClient::Tag](docs/Tag.md) + - [OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) + - [OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### http_auth + +- **Type**: HTTP basic authentication + diff --git a/samples/client/echo_api/ruby-httpx/Rakefile b/samples/client/echo_api/ruby-httpx/Rakefile new file mode 100644 index 00000000000..c72ca30d454 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/Rakefile @@ -0,0 +1,10 @@ +require "bundler/gem_tasks" + +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) + task default: :spec +rescue LoadError + # no rspec available +end diff --git a/samples/client/echo_api/ruby-httpx/docs/AuthApi.md b/samples/client/echo_api/ruby-httpx/docs/AuthApi.md new file mode 100644 index 00000000000..d82f08464e1 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/AuthApi.md @@ -0,0 +1,75 @@ +# OpenapiClient::AuthApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**test_auth_http_basic**](AuthApi.md#test_auth_http_basic) | **POST** /auth/http/basic | To test HTTP basic authentication | + + +## test_auth_http_basic + +> String test_auth_http_basic + +To test HTTP basic authentication + +To test HTTP basic authentication + +### Examples + +```ruby +require 'time' +require 'openapi_client' +# setup authorization +OpenapiClient.configure do |config| + # Configure HTTP basic authorization: http_auth + config.username = 'YOUR USERNAME' + config.password = 'YOUR PASSWORD' +end + +api_instance = OpenapiClient::AuthApi.new + +begin + # To test HTTP basic authentication + result = api_instance.test_auth_http_basic + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling AuthApi->test_auth_http_basic: #{e}" +end +``` + +#### Using the test_auth_http_basic_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_auth_http_basic_with_http_info + +```ruby +begin + # To test HTTP basic authentication + data, status_code, headers = api_instance.test_auth_http_basic_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling AuthApi->test_auth_http_basic_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[http_auth](../README.md#http_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + diff --git a/samples/client/echo_api/ruby-httpx/docs/Bird.md b/samples/client/echo_api/ruby-httpx/docs/Bird.md new file mode 100644 index 00000000000..53207a9a2f1 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/Bird.md @@ -0,0 +1,20 @@ +# OpenapiClient::Bird + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **size** | **String** | | [optional] | +| **color** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::Bird.new( + size: null, + color: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/BodyApi.md b/samples/client/echo_api/ruby-httpx/docs/BodyApi.md new file mode 100644 index 00000000000..89a5d10159a --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/BodyApi.md @@ -0,0 +1,469 @@ +# OpenapiClient::BodyApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body | +| [**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s) | +| [**test_body_multipart_formdata_array_of_binary**](BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime | +| [**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object | +| [**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s) | +| [**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body | +| [**test_echo_body_tag_response_string**](BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) | + + +## test_binary_gif + +> File test_binary_gif + +Test binary (gif) response body + +Test binary (gif) response body + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::BodyApi.new + +begin + # Test binary (gif) response body + result = api_instance.test_binary_gif + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_binary_gif: #{e}" +end +``` + +#### Using the test_binary_gif_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_binary_gif_with_http_info + +```ruby +begin + # Test binary (gif) response body + data, status_code, headers = api_instance.test_binary_gif_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => File +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_binary_gif_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**File** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: image/gif + + +## test_body_application_octetstream_binary + +> String test_body_application_octetstream_binary(opts) + +Test body parameter(s) + +Test body parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::BodyApi.new +opts = { + body: File.new('/path/to/some/file') # File | +} + +begin + # Test body parameter(s) + result = api_instance.test_body_application_octetstream_binary(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_body_application_octetstream_binary: #{e}" +end +``` + +#### Using the test_body_application_octetstream_binary_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_body_application_octetstream_binary_with_http_info(opts) + +```ruby +begin + # Test body parameter(s) + data, status_code, headers = api_instance.test_body_application_octetstream_binary_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_body_application_octetstream_binary_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **body** | **File** | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/octet-stream +- **Accept**: text/plain + + +## test_body_multipart_formdata_array_of_binary + +> String test_body_multipart_formdata_array_of_binary(files) + +Test array of binary in multipart mime + +Test array of binary in multipart mime + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::BodyApi.new +files = [File.new('/path/to/some/file')] # Array | + +begin + # Test array of binary in multipart mime + result = api_instance.test_body_multipart_formdata_array_of_binary(files) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_body_multipart_formdata_array_of_binary: #{e}" +end +``` + +#### Using the test_body_multipart_formdata_array_of_binary_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_body_multipart_formdata_array_of_binary_with_http_info(files) + +```ruby +begin + # Test array of binary in multipart mime + data, status_code, headers = api_instance.test_body_multipart_formdata_array_of_binary_with_http_info(files) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_body_multipart_formdata_array_of_binary_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **files** | **Array<File>** | | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: text/plain + + +## test_echo_body_free_form_object_response_string + +> String test_echo_body_free_form_object_response_string(opts) + +Test free form object + +Test free form object + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::BodyApi.new +opts = { + body: { ... } # Object | Free form object +} + +begin + # Test free form object + result = api_instance.test_echo_body_free_form_object_response_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_free_form_object_response_string: #{e}" +end +``` + +#### Using the test_echo_body_free_form_object_response_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_echo_body_free_form_object_response_string_with_http_info(opts) + +```ruby +begin + # Test free form object + data, status_code, headers = api_instance.test_echo_body_free_form_object_response_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_free_form_object_response_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **body** | **Object** | Free form object | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: text/plain + + +## test_echo_body_pet + +> test_echo_body_pet(opts) + +Test body parameter(s) + +Test body parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::BodyApi.new +opts = { + pet: OpenapiClient::Pet.new({name: 'doggie', photo_urls: ['photo_urls_example']}) # Pet | Pet object that needs to be added to the store +} + +begin + # Test body parameter(s) + result = api_instance.test_echo_body_pet(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_pet: #{e}" +end +``` + +#### Using the test_echo_body_pet_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> test_echo_body_pet_with_http_info(opts) + +```ruby +begin + # Test body parameter(s) + data, status_code, headers = api_instance.test_echo_body_pet_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_pet_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [optional] | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## test_echo_body_pet_response_string + +> String test_echo_body_pet_response_string(opts) + +Test empty response body + +Test empty response body + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::BodyApi.new +opts = { + pet: OpenapiClient::Pet.new({name: 'doggie', photo_urls: ['photo_urls_example']}) # Pet | Pet object that needs to be added to the store +} + +begin + # Test empty response body + result = api_instance.test_echo_body_pet_response_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_pet_response_string: #{e}" +end +``` + +#### Using the test_echo_body_pet_response_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_echo_body_pet_response_string_with_http_info(opts) + +```ruby +begin + # Test empty response body + data, status_code, headers = api_instance.test_echo_body_pet_response_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_pet_response_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: text/plain + + +## test_echo_body_tag_response_string + +> String test_echo_body_tag_response_string(opts) + +Test empty json (request body) + +Test empty json (request body) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::BodyApi.new +opts = { + tag: OpenapiClient::Tag.new # Tag | Tag object +} + +begin + # Test empty json (request body) + result = api_instance.test_echo_body_tag_response_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_tag_response_string: #{e}" +end +``` + +#### Using the test_echo_body_tag_response_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_echo_body_tag_response_string_with_http_info(opts) + +```ruby +begin + # Test empty json (request body) + data, status_code, headers = api_instance.test_echo_body_tag_response_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling BodyApi->test_echo_body_tag_response_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **tag** | [**Tag**](Tag.md) | Tag object | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: text/plain + diff --git a/samples/client/echo_api/ruby-httpx/docs/Category.md b/samples/client/echo_api/ruby-httpx/docs/Category.md new file mode 100644 index 00000000000..17adafbed75 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/Category.md @@ -0,0 +1,20 @@ +# OpenapiClient::Category + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | | [optional] | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::Category.new( + id: 1, + name: Dogs +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/DataQuery.md b/samples/client/echo_api/ruby-httpx/docs/DataQuery.md new file mode 100644 index 00000000000..2ef4c6b1a0d --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/DataQuery.md @@ -0,0 +1,22 @@ +# OpenapiClient::DataQuery + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **suffix** | **String** | test suffix | [optional] | +| **text** | **String** | Some text containing white spaces | [optional] | +| **date** | **Time** | A date | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::DataQuery.new( + suffix: null, + text: Some text, + date: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/DefaultValue.md b/samples/client/echo_api/ruby-httpx/docs/DefaultValue.md new file mode 100644 index 00000000000..72736b7608d --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/DefaultValue.md @@ -0,0 +1,32 @@ +# OpenapiClient::DefaultValue + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **array_string_enum_ref_default** | [**Array<StringEnumRef>**](StringEnumRef.md) | | [optional] | +| **array_string_enum_default** | **Array<String>** | | [optional] | +| **array_string_default** | **Array<String>** | | [optional] | +| **array_integer_default** | **Array<Integer>** | | [optional] | +| **array_string** | **Array<String>** | | [optional] | +| **array_string_nullable** | **Array<String>** | | [optional] | +| **array_string_extension_nullable** | **Array<String>** | | [optional] | +| **string_nullable** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::DefaultValue.new( + array_string_enum_ref_default: null, + array_string_enum_default: null, + array_string_default: null, + array_integer_default: null, + array_string: null, + array_string_nullable: null, + array_string_extension_nullable: null, + string_nullable: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/FormApi.md b/samples/client/echo_api/ruby-httpx/docs/FormApi.md new file mode 100644 index 00000000000..632949e8b80 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/FormApi.md @@ -0,0 +1,155 @@ +# OpenapiClient::FormApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) | +| [**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema | + + +## test_form_integer_boolean_string + +> String test_form_integer_boolean_string(opts) + +Test form parameter(s) + +Test form parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::FormApi.new +opts = { + integer_form: 56, # Integer | + boolean_form: true, # Boolean | + string_form: 'string_form_example' # String | +} + +begin + # Test form parameter(s) + result = api_instance.test_form_integer_boolean_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_integer_boolean_string: #{e}" +end +``` + +#### Using the test_form_integer_boolean_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_form_integer_boolean_string_with_http_info(opts) + +```ruby +begin + # Test form parameter(s) + data, status_code, headers = api_instance.test_form_integer_boolean_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_integer_boolean_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **integer_form** | **Integer** | | [optional] | +| **boolean_form** | **Boolean** | | [optional] | +| **string_form** | **String** | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: text/plain + + +## test_form_oneof + +> String test_form_oneof(opts) + +Test form parameter(s) for oneOf schema + +Test form parameter(s) for oneOf schema + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::FormApi.new +opts = { + form1: 'form1_example', # String | + form2: 56, # Integer | + form3: 'form3_example', # String | + form4: true, # Boolean | + id: 789, # Integer | + name: 'name_example' # String | +} + +begin + # Test form parameter(s) for oneOf schema + result = api_instance.test_form_oneof(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_oneof: #{e}" +end +``` + +#### Using the test_form_oneof_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_form_oneof_with_http_info(opts) + +```ruby +begin + # Test form parameter(s) for oneOf schema + data, status_code, headers = api_instance.test_form_oneof_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling FormApi->test_form_oneof_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **form1** | **String** | | [optional] | +| **form2** | **Integer** | | [optional] | +| **form3** | **String** | | [optional] | +| **form4** | **Boolean** | | [optional] | +| **id** | **Integer** | | [optional] | +| **name** | **String** | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: text/plain + diff --git a/samples/client/echo_api/ruby-httpx/docs/HeaderApi.md b/samples/client/echo_api/ruby-httpx/docs/HeaderApi.md new file mode 100644 index 00000000000..2bc9b97b599 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/HeaderApi.md @@ -0,0 +1,78 @@ +# OpenapiClient::HeaderApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**test_header_integer_boolean_string**](HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s) | + + +## test_header_integer_boolean_string + +> String test_header_integer_boolean_string(opts) + +Test header parameter(s) + +Test header parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::HeaderApi.new +opts = { + integer_header: 56, # Integer | + boolean_header: true, # Boolean | + string_header: 'string_header_example' # String | +} + +begin + # Test header parameter(s) + result = api_instance.test_header_integer_boolean_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling HeaderApi->test_header_integer_boolean_string: #{e}" +end +``` + +#### Using the test_header_integer_boolean_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_header_integer_boolean_string_with_http_info(opts) + +```ruby +begin + # Test header parameter(s) + data, status_code, headers = api_instance.test_header_integer_boolean_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling HeaderApi->test_header_integer_boolean_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **integer_header** | **Integer** | | [optional] | +| **boolean_header** | **Boolean** | | [optional] | +| **string_header** | **String** | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + diff --git a/samples/client/echo_api/ruby-httpx/docs/NumberPropertiesOnly.md b/samples/client/echo_api/ruby-httpx/docs/NumberPropertiesOnly.md new file mode 100644 index 00000000000..5040bff00dd --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/NumberPropertiesOnly.md @@ -0,0 +1,22 @@ +# OpenapiClient::NumberPropertiesOnly + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **number** | **Float** | | [optional] | +| **float** | **Float** | | [optional] | +| **double** | **Float** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::NumberPropertiesOnly.new( + number: null, + float: null, + double: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/PathApi.md b/samples/client/echo_api/ruby-httpx/docs/PathApi.md new file mode 100644 index 00000000000..8dd631156ba --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/PathApi.md @@ -0,0 +1,74 @@ +# OpenapiClient::PathApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**tests_path_string_path_string_integer_path_integer**](PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) | + + +## tests_path_string_path_string_integer_path_integer + +> String tests_path_string_path_string_integer_path_integer(path_string, path_integer) + +Test path parameter(s) + +Test path parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::PathApi.new +path_string = 'path_string_example' # String | +path_integer = 56 # Integer | + +begin + # Test path parameter(s) + result = api_instance.tests_path_string_path_string_integer_path_integer(path_string, path_integer) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling PathApi->tests_path_string_path_string_integer_path_integer: #{e}" +end +``` + +#### Using the tests_path_string_path_string_integer_path_integer_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer) + +```ruby +begin + # Test path parameter(s) + data, status_code, headers = api_instance.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling PathApi->tests_path_string_path_string_integer_path_integer_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **path_string** | **String** | | | +| **path_integer** | **Integer** | | | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + diff --git a/samples/client/echo_api/ruby-httpx/docs/Pet.md b/samples/client/echo_api/ruby-httpx/docs/Pet.md new file mode 100644 index 00000000000..817b46ce714 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/Pet.md @@ -0,0 +1,28 @@ +# OpenapiClient::Pet + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | | [optional] | +| **name** | **String** | | | +| **category** | [**Category**](Category.md) | | [optional] | +| **photo_urls** | **Array<String>** | | | +| **tags** | [**Array<Tag>**](Tag.md) | | [optional] | +| **status** | **String** | pet status in the store | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::Pet.new( + id: 10, + name: doggie, + category: null, + photo_urls: null, + tags: null, + status: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/Query.md b/samples/client/echo_api/ruby-httpx/docs/Query.md new file mode 100644 index 00000000000..e7b670a033d --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/Query.md @@ -0,0 +1,20 @@ +# OpenapiClient::Query + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | Query | [optional] | +| **outcomes** | **Array<String>** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::Query.new( + id: null, + outcomes: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/QueryApi.md b/samples/client/echo_api/ruby-httpx/docs/QueryApi.md new file mode 100644 index 00000000000..469c66a9047 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/QueryApi.md @@ -0,0 +1,551 @@ +# OpenapiClient::QueryApi + +All URIs are relative to *http://localhost:3000* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**test_enum_ref_string**](QueryApi.md#test_enum_ref_string) | **GET** /query/enum_ref_string | Test query parameter(s) | +| [**test_query_datetime_date_string**](QueryApi.md#test_query_datetime_date_string) | **GET** /query/datetime/date/string | Test query parameter(s) | +| [**test_query_integer_boolean_string**](QueryApi.md#test_query_integer_boolean_string) | **GET** /query/integer/boolean/string | Test query parameter(s) | +| [**test_query_style_deep_object_explode_true_object**](QueryApi.md#test_query_style_deep_object_explode_true_object) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) | +| [**test_query_style_deep_object_explode_true_object_all_of**](QueryApi.md#test_query_style_deep_object_explode_true_object_all_of) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) | +| [**test_query_style_form_explode_true_array_string**](QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) | +| [**test_query_style_form_explode_true_object**](QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s) | +| [**test_query_style_form_explode_true_object_all_of**](QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) | + + +## test_enum_ref_string + +> String test_enum_ref_string(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + enum_ref_string_query: OpenapiClient::StringEnumRef::SUCCESS # StringEnumRef | +} + +begin + # Test query parameter(s) + result = api_instance.test_enum_ref_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_enum_ref_string: #{e}" +end +``` + +#### Using the test_enum_ref_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_enum_ref_string_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_enum_ref_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_enum_ref_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enum_ref_string_query** | [**StringEnumRef**](.md) | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + + +## test_query_datetime_date_string + +> String test_query_datetime_date_string(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + datetime_query: Time.parse('2013-10-20T19:20:30+01:00'), # Time | + date_query: Date.parse('2013-10-20'), # Date | + string_query: 'string_query_example' # String | +} + +begin + # Test query parameter(s) + result = api_instance.test_query_datetime_date_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_datetime_date_string: #{e}" +end +``` + +#### Using the test_query_datetime_date_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_query_datetime_date_string_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_query_datetime_date_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_datetime_date_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **datetime_query** | **Time** | | [optional] | +| **date_query** | **Date** | | [optional] | +| **string_query** | **String** | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + + +## test_query_integer_boolean_string + +> String test_query_integer_boolean_string(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + integer_query: 56, # Integer | + boolean_query: true, # Boolean | + string_query: 'string_query_example' # String | +} + +begin + # Test query parameter(s) + result = api_instance.test_query_integer_boolean_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_integer_boolean_string: #{e}" +end +``` + +#### Using the test_query_integer_boolean_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_query_integer_boolean_string_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_query_integer_boolean_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_integer_boolean_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **integer_query** | **Integer** | | [optional] | +| **boolean_query** | **Boolean** | | [optional] | +| **string_query** | **String** | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + + +## test_query_style_deep_object_explode_true_object + +> String test_query_style_deep_object_explode_true_object(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + query_object: OpenapiClient::Pet.new({name: 'doggie', photo_urls: ['photo_urls_example']}) # Pet | +} + +begin + # Test query parameter(s) + result = api_instance.test_query_style_deep_object_explode_true_object(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_deep_object_explode_true_object: #{e}" +end +``` + +#### Using the test_query_style_deep_object_explode_true_object_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_query_style_deep_object_explode_true_object_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_query_style_deep_object_explode_true_object_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_deep_object_explode_true_object_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **query_object** | [**Pet**](.md) | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + + +## test_query_style_deep_object_explode_true_object_all_of + +> String test_query_style_deep_object_explode_true_object_all_of(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + query_object: OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.new # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | +} + +begin + # Test query parameter(s) + result = api_instance.test_query_style_deep_object_explode_true_object_all_of(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_deep_object_explode_true_object_all_of: #{e}" +end +``` + +#### Using the test_query_style_deep_object_explode_true_object_all_of_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_query_style_deep_object_explode_true_object_all_of_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_query_style_deep_object_explode_true_object_all_of_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_deep_object_explode_true_object_all_of_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](.md) | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + + +## test_query_style_form_explode_true_array_string + +> String test_query_style_form_explode_true_array_string(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + query_object: OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.new # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | +} + +begin + # Test query parameter(s) + result = api_instance.test_query_style_form_explode_true_array_string(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_form_explode_true_array_string: #{e}" +end +``` + +#### Using the test_query_style_form_explode_true_array_string_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_query_style_form_explode_true_array_string_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_query_style_form_explode_true_array_string_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_form_explode_true_array_string_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md) | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + + +## test_query_style_form_explode_true_object + +> String test_query_style_form_explode_true_object(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + query_object: OpenapiClient::Pet.new({name: 'doggie', photo_urls: ['photo_urls_example']}) # Pet | +} + +begin + # Test query parameter(s) + result = api_instance.test_query_style_form_explode_true_object(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_form_explode_true_object: #{e}" +end +``` + +#### Using the test_query_style_form_explode_true_object_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_query_style_form_explode_true_object_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_query_style_form_explode_true_object_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_form_explode_true_object_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **query_object** | [**Pet**](.md) | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + + +## test_query_style_form_explode_true_object_all_of + +> String test_query_style_form_explode_true_object_all_of(opts) + +Test query parameter(s) + +Test query parameter(s) + +### Examples + +```ruby +require 'time' +require 'openapi_client' + +api_instance = OpenapiClient::QueryApi.new +opts = { + query_object: OpenapiClient::DataQuery.new # DataQuery | +} + +begin + # Test query parameter(s) + result = api_instance.test_query_style_form_explode_true_object_all_of(opts) + p result +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_form_explode_true_object_all_of: #{e}" +end +``` + +#### Using the test_query_style_form_explode_true_object_all_of_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> test_query_style_form_explode_true_object_all_of_with_http_info(opts) + +```ruby +begin + # Test query parameter(s) + data, status_code, headers = api_instance.test_query_style_form_explode_true_object_all_of_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OpenapiClient::ApiError => e + puts "Error when calling QueryApi->test_query_style_form_explode_true_object_all_of_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **query_object** | [**DataQuery**](.md) | | [optional] | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: text/plain + diff --git a/samples/client/echo_api/ruby-httpx/docs/StringEnumRef.md b/samples/client/echo_api/ruby-httpx/docs/StringEnumRef.md new file mode 100644 index 00000000000..169bcb44d76 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/StringEnumRef.md @@ -0,0 +1,15 @@ +# OpenapiClient::StringEnumRef + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::StringEnumRef.new() +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/Tag.md b/samples/client/echo_api/ruby-httpx/docs/Tag.md new file mode 100644 index 00000000000..d3bcb5933ab --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/Tag.md @@ -0,0 +1,20 @@ +# OpenapiClient::Tag + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | | [optional] | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::Tag.new( + id: null, + name: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/ruby-httpx/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md new file mode 100644 index 00000000000..a0f7cd16fe8 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md @@ -0,0 +1,24 @@ +# OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **size** | **String** | | [optional] | +| **color** | **String** | | [optional] | +| **id** | **Integer** | | [optional] | +| **name** | **String** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.new( + size: null, + color: null, + id: 1, + name: Dogs +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/ruby-httpx/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 00000000000..b21365f8f3a --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,18 @@ +# OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **values** | **Array<String>** | | [optional] | + +## Example + +```ruby +require 'openapi_client' + +instance = OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.new( + values: null +) +``` + diff --git a/samples/client/echo_api/ruby-httpx/git_push.sh b/samples/client/echo_api/ruby-httpx/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client.rb new file mode 100644 index 00000000000..ed71a17389e --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client.rb @@ -0,0 +1,56 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +# Common files +require 'openapi_client/api_client' +require 'openapi_client/api_error' +require 'openapi_client/version' +require 'openapi_client/configuration' + +# Models +require 'openapi_client/models/bird' +require 'openapi_client/models/category' +require 'openapi_client/models/default_value' +require 'openapi_client/models/number_properties_only' +require 'openapi_client/models/pet' +require 'openapi_client/models/query' +require 'openapi_client/models/string_enum_ref' +require 'openapi_client/models/tag' +require 'openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter' +require 'openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter' +require 'openapi_client/models/data_query' + +# APIs +require 'openapi_client/api/auth_api' +require 'openapi_client/api/body_api' +require 'openapi_client/api/form_api' +require 'openapi_client/api/header_api' +require 'openapi_client/api/path_api' +require 'openapi_client/api/query_api' + +module OpenapiClient + class << self + # Customize default settings for the SDK using block. + # OpenapiClient.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb new file mode 100644 index 00000000000..a5922ca0ade --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/auth_api.rb @@ -0,0 +1,79 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'cgi' + +module OpenapiClient + class AuthApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # To test HTTP basic authentication + # To test HTTP basic authentication + # @param [Hash] opts the optional parameters + # @return [String] + def test_auth_http_basic(opts = {}) + data, _status_code, _headers = test_auth_http_basic_with_http_info(opts) + data + end + + # To test HTTP basic authentication + # To test HTTP basic authentication + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_auth_http_basic_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: AuthApi.test_auth_http_basic ...' + end + # resource path + local_var_path = '/auth/http/basic' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || ['http_auth'] + + new_options = opts.merge( + :operation => :"AuthApi.test_auth_http_basic", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: AuthApi#test_auth_http_basic\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb new file mode 100644 index 00000000000..1a9970d95a3 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/body_api.rb @@ -0,0 +1,468 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'cgi' + +module OpenapiClient + class BodyApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Test binary (gif) response body + # Test binary (gif) response body + # @param [Hash] opts the optional parameters + # @return [File] + def test_binary_gif(opts = {}) + data, _status_code, _headers = test_binary_gif_with_http_info(opts) + data + end + + # Test binary (gif) response body + # Test binary (gif) response body + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def test_binary_gif_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BodyApi.test_binary_gif ...' + end + # resource path + local_var_path = '/binary/gif' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['image/gif']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"BodyApi.test_binary_gif", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BodyApi#test_binary_gif\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test body parameter(s) + # Test body parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [File] :body + # @return [String] + def test_body_application_octetstream_binary(opts = {}) + data, _status_code, _headers = test_body_application_octetstream_binary_with_http_info(opts) + data + end + + # Test body parameter(s) + # Test body parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [File] :body + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_body_application_octetstream_binary_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BodyApi.test_body_application_octetstream_binary ...' + end + # resource path + local_var_path = '/body/application/octetstream/binary' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/octet-stream']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body']) + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"BodyApi.test_body_application_octetstream_binary", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BodyApi#test_body_application_octetstream_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test array of binary in multipart mime + # Test array of binary in multipart mime + # @param files [Array] + # @param [Hash] opts the optional parameters + # @return [String] + def test_body_multipart_formdata_array_of_binary(files, opts = {}) + data, _status_code, _headers = test_body_multipart_formdata_array_of_binary_with_http_info(files, opts) + data + end + + # Test array of binary in multipart mime + # Test array of binary in multipart mime + # @param files [Array] + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_body_multipart_formdata_array_of_binary_with_http_info(files, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BodyApi.test_body_multipart_formdata_array_of_binary ...' + end + # verify the required parameter 'files' is set + if @api_client.config.client_side_validation && files.nil? + fail ArgumentError, "Missing the required parameter 'files' when calling BodyApi.test_body_multipart_formdata_array_of_binary" + end + # resource path + local_var_path = '/body/application/octetstream/array_of_binary' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['multipart/form-data']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['files'] = @api_client.build_collection_param(files, :csv) + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"BodyApi.test_body_multipart_formdata_array_of_binary", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BodyApi#test_body_multipart_formdata_array_of_binary\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test free form object + # Test free form object + # @param [Hash] opts the optional parameters + # @option opts [Object] :body Free form object + # @return [String] + def test_echo_body_free_form_object_response_string(opts = {}) + data, _status_code, _headers = test_echo_body_free_form_object_response_string_with_http_info(opts) + data + end + + # Test free form object + # Test free form object + # @param [Hash] opts the optional parameters + # @option opts [Object] :body Free form object + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_echo_body_free_form_object_response_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BodyApi.test_echo_body_free_form_object_response_string ...' + end + # resource path + local_var_path = '/echo/body/FreeFormObject/response_string' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body']) + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"BodyApi.test_echo_body_free_form_object_response_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BodyApi#test_echo_body_free_form_object_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test body parameter(s) + # Test body parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :pet Pet object that needs to be added to the store + # @return [Pet] + def test_echo_body_pet(opts = {}) + data, _status_code, _headers = test_echo_body_pet_with_http_info(opts) + data + end + + # Test body parameter(s) + # Test body parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [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 test_echo_body_pet_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BodyApi.test_echo_body_pet ...' + end + # resource path + local_var_path = '/echo/body/Pet' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'pet']) + + # return_type + return_type = opts[:debug_return_type] || 'Pet' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"BodyApi.test_echo_body_pet", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test empty response body + # Test empty response body + # @param [Hash] opts the optional parameters + # @option opts [Pet] :pet Pet object that needs to be added to the store + # @return [String] + def test_echo_body_pet_response_string(opts = {}) + data, _status_code, _headers = test_echo_body_pet_response_string_with_http_info(opts) + data + end + + # Test empty response body + # Test empty response body + # @param [Hash] opts the optional parameters + # @option opts [Pet] :pet Pet object that needs to be added to the store + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_echo_body_pet_response_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BodyApi.test_echo_body_pet_response_string ...' + end + # resource path + local_var_path = '/echo/body/Pet/response_string' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'pet']) + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"BodyApi.test_echo_body_pet_response_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BodyApi#test_echo_body_pet_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test empty json (request body) + # Test empty json (request body) + # @param [Hash] opts the optional parameters + # @option opts [Tag] :tag Tag object + # @return [String] + def test_echo_body_tag_response_string(opts = {}) + data, _status_code, _headers = test_echo_body_tag_response_string_with_http_info(opts) + data + end + + # Test empty json (request body) + # Test empty json (request body) + # @param [Hash] opts the optional parameters + # @option opts [Tag] :tag Tag object + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_echo_body_tag_response_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BodyApi.test_echo_body_tag_response_string ...' + end + # resource path + local_var_path = '/echo/body/Tag/response_string' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'tag']) + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"BodyApi.test_echo_body_tag_response_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BodyApi#test_echo_body_tag_response_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb new file mode 100644 index 00000000000..a387e7b5f53 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/form_api.rb @@ -0,0 +1,173 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'cgi' + +module OpenapiClient + class FormApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Test form parameter(s) + # Test form parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_form + # @option opts [Boolean] :boolean_form + # @option opts [String] :string_form + # @return [String] + def test_form_integer_boolean_string(opts = {}) + data, _status_code, _headers = test_form_integer_boolean_string_with_http_info(opts) + data + end + + # Test form parameter(s) + # Test form parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_form + # @option opts [Boolean] :boolean_form + # @option opts [String] :string_form + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_form_integer_boolean_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormApi.test_form_integer_boolean_string ...' + end + # resource path + local_var_path = '/form/integer/boolean/string' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['integer_form'] = opts[:'integer_form'] if !opts[:'integer_form'].nil? + form_params['boolean_form'] = opts[:'boolean_form'] if !opts[:'boolean_form'].nil? + form_params['string_form'] = opts[:'string_form'] if !opts[:'string_form'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FormApi.test_form_integer_boolean_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormApi#test_form_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test form parameter(s) for oneOf schema + # Test form parameter(s) for oneOf schema + # @param [Hash] opts the optional parameters + # @option opts [String] :form1 + # @option opts [Integer] :form2 + # @option opts [String] :form3 + # @option opts [Boolean] :form4 + # @option opts [Integer] :id + # @option opts [String] :name + # @return [String] + def test_form_oneof(opts = {}) + data, _status_code, _headers = test_form_oneof_with_http_info(opts) + data + end + + # Test form parameter(s) for oneOf schema + # Test form parameter(s) for oneOf schema + # @param [Hash] opts the optional parameters + # @option opts [String] :form1 + # @option opts [Integer] :form2 + # @option opts [String] :form3 + # @option opts [Boolean] :form4 + # @option opts [Integer] :id + # @option opts [String] :name + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_form_oneof_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FormApi.test_form_oneof ...' + end + # resource path + local_var_path = '/form/oneof' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + form_params['form1'] = opts[:'form1'] if !opts[:'form1'].nil? + form_params['form2'] = opts[:'form2'] if !opts[:'form2'].nil? + form_params['form3'] = opts[:'form3'] if !opts[:'form3'].nil? + form_params['form4'] = opts[:'form4'] if !opts[:'form4'].nil? + form_params['id'] = opts[:'id'] if !opts[:'id'].nil? + form_params['name'] = opts[:'name'] if !opts[:'name'].nil? + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FormApi.test_form_oneof", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FormApi#test_form_oneof\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb new file mode 100644 index 00000000000..ef44f1aa9c6 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/header_api.rb @@ -0,0 +1,88 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'cgi' + +module OpenapiClient + class HeaderApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Test header parameter(s) + # Test header parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_header + # @option opts [Boolean] :boolean_header + # @option opts [String] :string_header + # @return [String] + def test_header_integer_boolean_string(opts = {}) + data, _status_code, _headers = test_header_integer_boolean_string_with_http_info(opts) + data + end + + # Test header parameter(s) + # Test header parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_header + # @option opts [Boolean] :boolean_header + # @option opts [String] :string_header + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_header_integer_boolean_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: HeaderApi.test_header_integer_boolean_string ...' + end + # resource path + local_var_path = '/header/integer/boolean/string' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + header_params['integer_header'] = opts[:'integer_header'] if !opts[:'integer_header'].nil? + header_params['boolean_header'] = opts[:'boolean_header'] if !opts[:'boolean_header'].nil? + header_params['string_header'] = opts[:'string_header'] if !opts[:'string_header'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"HeaderApi.test_header_integer_boolean_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: HeaderApi#test_header_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb new file mode 100644 index 00000000000..5d24f154ae6 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/path_api.rb @@ -0,0 +1,91 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'cgi' + +module OpenapiClient + class PathApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Test path parameter(s) + # Test path parameter(s) + # @param path_string [String] + # @param path_integer [Integer] + # @param [Hash] opts the optional parameters + # @return [String] + def tests_path_string_path_string_integer_path_integer(path_string, path_integer, opts = {}) + data, _status_code, _headers = tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, opts) + data + end + + # Test path parameter(s) + # Test path parameter(s) + # @param path_string [String] + # @param path_integer [Integer] + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PathApi.tests_path_string_path_string_integer_path_integer ...' + end + # verify the required parameter 'path_string' is set + if @api_client.config.client_side_validation && path_string.nil? + fail ArgumentError, "Missing the required parameter 'path_string' when calling PathApi.tests_path_string_path_string_integer_path_integer" + end + # verify the required parameter 'path_integer' is set + if @api_client.config.client_side_validation && path_integer.nil? + fail ArgumentError, "Missing the required parameter 'path_integer' when calling PathApi.tests_path_string_path_string_integer_path_integer" + end + # resource path + local_var_path = '/path/string/{path_string}/integer/{path_integer}'.sub('{' + 'path_string' + '}', CGI.escape(path_string.to_s)).sub('{' + 'path_integer' + '}', CGI.escape(path_integer.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"PathApi.tests_path_string_path_string_integer_path_integer", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PathApi#tests_path_string_path_string_integer_path_integer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb new file mode 100644 index 00000000000..a40ab497720 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api/query_api.rb @@ -0,0 +1,514 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'cgi' + +module OpenapiClient + class QueryApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [StringEnumRef] :enum_ref_string_query + # @return [String] + def test_enum_ref_string(opts = {}) + data, _status_code, _headers = test_enum_ref_string_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [StringEnumRef] :enum_ref_string_query + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_enum_ref_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_enum_ref_string ...' + end + # resource path + local_var_path = '/query/enum_ref_string' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'enum_ref_string_query'] = opts[:'enum_ref_string_query'] if !opts[:'enum_ref_string_query'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_enum_ref_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_enum_ref_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Time] :datetime_query + # @option opts [Date] :date_query + # @option opts [String] :string_query + # @return [String] + def test_query_datetime_date_string(opts = {}) + data, _status_code, _headers = test_query_datetime_date_string_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Time] :datetime_query + # @option opts [Date] :date_query + # @option opts [String] :string_query + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_query_datetime_date_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_query_datetime_date_string ...' + end + # resource path + local_var_path = '/query/datetime/date/string' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'datetime_query'] = opts[:'datetime_query'] if !opts[:'datetime_query'].nil? + query_params[:'date_query'] = opts[:'date_query'] if !opts[:'date_query'].nil? + query_params[:'string_query'] = opts[:'string_query'] if !opts[:'string_query'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_query_datetime_date_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_query_datetime_date_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_query + # @option opts [Boolean] :boolean_query + # @option opts [String] :string_query + # @return [String] + def test_query_integer_boolean_string(opts = {}) + data, _status_code, _headers = test_query_integer_boolean_string_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_query + # @option opts [Boolean] :boolean_query + # @option opts [String] :string_query + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_query_integer_boolean_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_query_integer_boolean_string ...' + end + # resource path + local_var_path = '/query/integer/boolean/string' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'integer_query'] = opts[:'integer_query'] if !opts[:'integer_query'].nil? + query_params[:'boolean_query'] = opts[:'boolean_query'] if !opts[:'boolean_query'].nil? + query_params[:'string_query'] = opts[:'string_query'] if !opts[:'string_query'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_query_integer_boolean_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_query_integer_boolean_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :query_object + # @return [String] + def test_query_style_deep_object_explode_true_object(opts = {}) + data, _status_code, _headers = test_query_style_deep_object_explode_true_object_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :query_object + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_query_style_deep_object_explode_true_object_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_query_style_deep_object_explode_true_object ...' + end + # resource path + local_var_path = '/query/style_deepObject/explode_true/object' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'query_object'] = opts[:'query_object'] if !opts[:'query_object'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_query_style_deep_object_explode_true_object", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter] :query_object + # @return [String] + def test_query_style_deep_object_explode_true_object_all_of(opts = {}) + data, _status_code, _headers = test_query_style_deep_object_explode_true_object_all_of_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter] :query_object + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_query_style_deep_object_explode_true_object_all_of_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_query_style_deep_object_explode_true_object_all_of ...' + end + # resource path + local_var_path = '/query/style_deepObject/explode_true/object/allOf' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'query_object'] = opts[:'query_object'] if !opts[:'query_object'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_query_style_deep_object_explode_true_object_all_of", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_query_style_deep_object_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] :query_object + # @return [String] + def test_query_style_form_explode_true_array_string(opts = {}) + data, _status_code, _headers = test_query_style_form_explode_true_array_string_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] :query_object + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_query_style_form_explode_true_array_string_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_query_style_form_explode_true_array_string ...' + end + # resource path + local_var_path = '/query/style_form/explode_true/array_string' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'query_object'] = opts[:'query_object'] if !opts[:'query_object'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_query_style_form_explode_true_array_string", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_array_string\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :query_object + # @return [String] + def test_query_style_form_explode_true_object(opts = {}) + data, _status_code, _headers = test_query_style_form_explode_true_object_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :query_object + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_query_style_form_explode_true_object_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_query_style_form_explode_true_object ...' + end + # resource path + local_var_path = '/query/style_form/explode_true/object' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'query_object'] = opts[:'query_object'] if !opts[:'query_object'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_query_style_form_explode_true_object", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [DataQuery] :query_object + # @return [String] + def test_query_style_form_explode_true_object_all_of(opts = {}) + data, _status_code, _headers = test_query_style_form_explode_true_object_all_of_with_http_info(opts) + data + end + + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [DataQuery] :query_object + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def test_query_style_form_explode_true_object_all_of_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: QueryApi.test_query_style_form_explode_true_object_all_of ...' + end + # resource path + local_var_path = '/query/style_form/explode_true/object/allOf' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'query_object'] = opts[:'query_object'] if !opts[:'query_object'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/plain']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"QueryApi.test_query_style_form_explode_true_object_all_of", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: QueryApi#test_query_style_form_explode_true_object_all_of\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb new file mode 100644 index 00000000000..9adce447ee7 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_client.rb @@ -0,0 +1,375 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'httpx' +require 'net/http/status' + + +module OpenapiClient + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "OpenAPI-Generator/#{VERSION}/ruby" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + begin + response = build_request(http_method.to_s, path, opts) + + if config.debugging + config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + response.raise_for_status + + rescue HTTPX::HTTPError + fail ApiError.new(code: response.status, + response_headers: response.headers.to_h, + response_body: response.body.to_s), + Net::HTTP::STATUS_CODES.fetch(response.status, "HTTP Error (#{response.status})") + rescue HTTPX::TimeoutError + fail ApiError.new('Connection timed out') + rescue HTTPX::ConnectionError + fail ApiError.new('Connection failed') + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.status, response.headers.to_h + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [HTTPX::Request] A Request object + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + if %w[POST PATCH PUT DELETE].include?(http_method) + body_params = build_request_body(header_params, form_params, opts[:body]) + if config.debugging + config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + else + body_params = {} + end + req_opts = { + :headers => HTTPX::Headers.new(header_params), + **body_params + } + req_opts[:params] = query_params if query_params && !query_params.empty? + session.request(http_method, url, **req_opts) + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [Hash{Symbol => Object}] body options as HTTPX handles them + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = { form: form_params } + elsif body + + data = body.is_a?(String) ? { body: body } : { json: body } + else + data = nil + end + data + end + + def session + return @session if defined?(@session) + + session = HTTPX.with( + ssl: @config.ssl, + timeout: ({ request_timeout: @config.timeout } if @config.timeout && @config.timeout.positive?), + origin: "#{@config.scheme}://#{@config.host}", + base_path: (@config.base_path.sub(/\/+\z/, '') if @config.base_path) + ) + + if @config.proxy + session = session.plugin(:proxy, proxy: @config.proxy) + end + + if @config.username && @config.password + session = session.plugin(:basic_auth).basic_auth(@config.username, @config.password) + end + + session = @config.configure(session) + + @session = session + + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + if return_type == 'File' + if @config.return_binary_data == true + # TODO: force response encoding + return body.to_s + else + content_disposition = response.headers['content-disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + response.copy_to(tempfile) + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + + return tempfile + end + end + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body.to_s if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_error.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_error.rb new file mode 100644 index 00000000000..8b2759ed2a4 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/api_error.rb @@ -0,0 +1,58 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +module OpenapiClient + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/configuration.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/configuration.rb new file mode 100644 index 00000000000..bd2fd9bf103 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/configuration.rb @@ -0,0 +1,285 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +module OpenapiClient + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # You can use this to customize SSL Context settings (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html + # to know which ones). + # + # @return [Hash{Symbol => Object}, OpenSSL::SSL::SSLContext, nil] + attr_accessor :ssl + + ### Proxy setting + # HTTP Proxy settings (see https://honeyryderchuck.gitlab.io/httpx/wiki/Proxy#options) + # @return [Hash{Symbol => Object}, nil] + attr_accessor :proxy + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'http' + @host = 'localhost:3000' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @ssl = nil + @proxy = nil + @timeout = 60 + @configure_session_blocks = [] + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'http_auth' => + { + type: 'basic', + in: 'header', + key: 'Authorization', + value: basic_auth_token + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "http://localhost:3000", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + + # Configure Httpx session directly. + # + # ``` + # c.configure_session do |http| + # http.plugin(:follow_redirects).with(debug: STDOUT, debug_level: 1) + # end + # ``` + # + # @param block [Proc] `#call`able object that takes one arg, the connection + def configure_session(&block) + @configure_session_blocks << block + end + + + def configure(session) + @configure_session_blocks.reduce(session) do |configured_sess, block| + block.call(configured_sess) + end + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb new file mode 100644 index 00000000000..36503338037 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/bird.rb @@ -0,0 +1,223 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class Bird + attr_accessor :size + + attr_accessor :color + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'size' => :'size', + :'color' => :'color' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'size' => :'String', + :'color' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Bird` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Bird`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + size == o.size && + color == o.color + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [size, color].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb new file mode 100644 index 00000000000..d8433b0236d --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/category.rb @@ -0,0 +1,223 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class Category + attr_accessor :id + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Category` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb new file mode 100644 index 00000000000..9fd58e63b27 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/data_query.rb @@ -0,0 +1,268 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class DataQuery < Query + # test suffix + attr_accessor :suffix + + # Some text containing white spaces + attr_accessor :text + + # A date + attr_accessor :date + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'suffix' => :'suffix', + :'text' => :'text', + :'date' => :'date' + } + end + + # Returns all the JSON keys this model knows about, including the ones defined in its parent(s) + def self.acceptable_attributes + attribute_map.values.concat(superclass.acceptable_attributes) + end + + # Attribute type mapping. + def self.openapi_types + { + :'suffix' => :'String', + :'text' => :'String', + :'date' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Query' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::DataQuery` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DataQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + # call parent's initialize + super(attributes) + + if attributes.key?(:'suffix') + self.suffix = attributes[:'suffix'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = super + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true && super + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + suffix == o.suffix && + text == o.text && + date == o.date && super(o) + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [suffix, text, date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + super(attributes) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = super + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb new file mode 100644 index 00000000000..957a945a2fc --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/default_value.rb @@ -0,0 +1,317 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + # to test the default value of properties + class DefaultValue + attr_accessor :array_string_enum_ref_default + + attr_accessor :array_string_enum_default + + attr_accessor :array_string_default + + attr_accessor :array_integer_default + + attr_accessor :array_string + + attr_accessor :array_string_nullable + + attr_accessor :array_string_extension_nullable + + attr_accessor :string_nullable + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'array_string_enum_ref_default' => :'array_string_enum_ref_default', + :'array_string_enum_default' => :'array_string_enum_default', + :'array_string_default' => :'array_string_default', + :'array_integer_default' => :'array_integer_default', + :'array_string' => :'array_string', + :'array_string_nullable' => :'array_string_nullable', + :'array_string_extension_nullable' => :'array_string_extension_nullable', + :'string_nullable' => :'string_nullable' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'array_string_enum_ref_default' => :'Array', + :'array_string_enum_default' => :'Array', + :'array_string_default' => :'Array', + :'array_integer_default' => :'Array', + :'array_string' => :'Array', + :'array_string_nullable' => :'Array', + :'array_string_extension_nullable' => :'Array', + :'string_nullable' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'array_string_nullable', + :'array_string_extension_nullable', + :'string_nullable' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::DefaultValue` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::DefaultValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'array_string_enum_ref_default') + if (value = attributes[:'array_string_enum_ref_default']).is_a?(Array) + self.array_string_enum_ref_default = value + end + end + + if attributes.key?(:'array_string_enum_default') + if (value = attributes[:'array_string_enum_default']).is_a?(Array) + self.array_string_enum_default = value + end + end + + if attributes.key?(:'array_string_default') + if (value = attributes[:'array_string_default']).is_a?(Array) + self.array_string_default = value + end + end + + if attributes.key?(:'array_integer_default') + if (value = attributes[:'array_integer_default']).is_a?(Array) + self.array_integer_default = value + end + end + + if attributes.key?(:'array_string') + if (value = attributes[:'array_string']).is_a?(Array) + self.array_string = value + end + end + + if attributes.key?(:'array_string_nullable') + if (value = attributes[:'array_string_nullable']).is_a?(Array) + self.array_string_nullable = value + end + end + + if attributes.key?(:'array_string_extension_nullable') + if (value = attributes[:'array_string_extension_nullable']).is_a?(Array) + self.array_string_extension_nullable = value + end + end + + if attributes.key?(:'string_nullable') + self.string_nullable = attributes[:'string_nullable'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + array_string_enum_ref_default == o.array_string_enum_ref_default && + array_string_enum_default == o.array_string_enum_default && + array_string_default == o.array_string_default && + array_integer_default == o.array_integer_default && + array_string == o.array_string && + array_string_nullable == o.array_string_nullable && + array_string_extension_nullable == o.array_string_extension_nullable && + string_nullable == o.string_nullable + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [array_string_enum_ref_default, array_string_enum_default, array_string_default, array_integer_default, array_string, array_string_nullable, array_string_extension_nullable, string_nullable].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb new file mode 100644 index 00000000000..d4b05f3c1aa --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/number_properties_only.rb @@ -0,0 +1,260 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class NumberPropertiesOnly + attr_accessor :number + + attr_accessor :float + + attr_accessor :double + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'number' => :'number', + :'float' => :'float', + :'double' => :'double' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'number' => :'Float', + :'float' => :'Float', + :'double' => :'Float' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::NumberPropertiesOnly` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::NumberPropertiesOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'number') + self.number = attributes[:'number'] + end + + if attributes.key?(:'float') + self.float = attributes[:'float'] + end + + if attributes.key?(:'double') + self.double = attributes[:'double'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@double.nil? && @double > 50.2 + invalid_properties.push('invalid value for "double", must be smaller than or equal to 50.2.') + end + + if !@double.nil? && @double < 0.8 + invalid_properties.push('invalid value for "double", must be greater than or equal to 0.8.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@double.nil? && @double > 50.2 + return false if !@double.nil? && @double < 0.8 + true + end + + # Custom attribute writer method with validation + # @param [Object] double Value to be assigned + def double=(double) + if double.nil? + fail ArgumentError, 'double cannot be nil' + end + + if double > 50.2 + fail ArgumentError, 'invalid value for "double", must be smaller than or equal to 50.2.' + end + + if double < 0.8 + fail ArgumentError, 'invalid value for "double", must be greater than or equal to 0.8.' + end + + @double = double + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + number == o.number && + float == o.float && + double == o.double + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [number, float, double].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb new file mode 100644 index 00000000000..a37a969818c --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/pet.rb @@ -0,0 +1,312 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class Pet + attr_accessor :id + + attr_accessor :name + + attr_accessor :category + + attr_accessor :photo_urls + + attr_accessor :tags + + # pet status in the store + attr_accessor :status + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'category' => :'category', + :'photo_urls' => :'photoUrls', + :'tags' => :'tags', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'name' => :'String', + :'category' => :'Category', + :'photo_urls' => :'Array', + :'tags' => :'Array', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Pet` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Pet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'photo_urls') + if (value = attributes[:'photo_urls']).is_a?(Array) + self.photo_urls = value + end + else + self.photo_urls = nil + end + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @photo_urls.nil? + invalid_properties.push('invalid value for "photo_urls", photo_urls cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @name.nil? + return false if @photo_urls.nil? + status_validator = EnumAttributeValidator.new('String', ["available", "pending", "sold"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["available", "pending", "sold"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + category == o.category && + photo_urls == o.photo_urls && + tags == o.tags && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, category, photo_urls, tags, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb new file mode 100644 index 00000000000..0bf87a36317 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/query.rb @@ -0,0 +1,248 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class Query + # Query + attr_accessor :id + + attr_accessor :outcomes + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'outcomes' => :'outcomes' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'outcomes' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Query` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Query`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'outcomes') + if (value = attributes[:'outcomes']).is_a?(Array) + self.outcomes = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + outcomes == o.outcomes + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, outcomes].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/string_enum_ref.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/string_enum_ref.rb new file mode 100644 index 00000000000..6bcbcf63da9 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/string_enum_ref.rb @@ -0,0 +1,41 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class StringEnumRef + SUCCESS = "success".freeze + FAILURE = "failure".freeze + UNCLASSIFIED = "unclassified".freeze + + def self.all_vars + @all_vars ||= [SUCCESS, FAILURE, UNCLASSIFIED].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if StringEnumRef.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #StringEnumRef" + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb new file mode 100644 index 00000000000..58dfc611926 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/tag.rb @@ -0,0 +1,223 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class Tag + attr_accessor :id + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::Tag` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::Tag`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb new file mode 100644 index 00000000000..47baf2203b0 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.rb @@ -0,0 +1,249 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + attr_accessor :size + + attr_accessor :color + + attr_accessor :id + + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'size' => :'size', + :'color' => :'color', + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'size' => :'String', + :'color' => :'String', + :'id' => :'Integer', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Bird', + :'Category' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'size') + self.size = attributes[:'size'] + end + + if attributes.key?(:'color') + self.color = attributes[:'color'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + size == o.size && + color == o.color && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [size, color, id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb new file mode 100644 index 00000000000..50c87fbae0e --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.rb @@ -0,0 +1,216 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OpenapiClient + class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + attr_accessor :values + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'values' => :'values' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'values' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'values') + if (value = attributes[:'values']).is_a?(Array) + self.values = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + values == o.values + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [values].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OpenapiClient.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/echo_api/ruby-httpx/lib/openapi_client/version.rb b/samples/client/echo_api/ruby-httpx/lib/openapi_client/version.rb new file mode 100644 index 00000000000..563f648be69 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/lib/openapi_client/version.rb @@ -0,0 +1,15 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +module OpenapiClient + VERSION = '1.0.0' +end diff --git a/samples/client/echo_api/ruby-httpx/openapi_client.gemspec b/samples/client/echo_api/ruby-httpx/openapi_client.gemspec new file mode 100644 index 00000000000..d479c1892b0 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/openapi_client.gemspec @@ -0,0 +1,38 @@ +# -*- encoding: utf-8 -*- + +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +$:.push File.expand_path("../lib", __FILE__) +require "openapi_client/version" + +Gem::Specification.new do |s| + s.name = "openapi_client" + s.version = OpenapiClient::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["OpenAPI-Generator"] + s.email = ["team@openapitools.org"] + s.homepage = "https://openapi-generator.tech" + s.summary = "Echo Server API Ruby Gem" + s.description = "Echo Server API" + s.license = "Unlicense" + s.required_ruby_version = ">= 2.7" + + s.add_runtime_dependency 'httpx', '~> 1.0', '>= 1.0.0' + + s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' + + s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } + s.test_files = `find spec/*`.split("\n") + s.executables = [] + s.require_paths = ["lib"] +end diff --git a/samples/client/echo_api/ruby-httpx/spec/api/auth_api_spec.rb b/samples/client/echo_api/ruby-httpx/spec/api/auth_api_spec.rb new file mode 100644 index 00000000000..0cc2f1182ba --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/api/auth_api_spec.rb @@ -0,0 +1,46 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for OpenapiClient::AuthApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'AuthApi' do + before do + # run before each test + @api_instance = OpenapiClient::AuthApi.new + end + + after do + # run after each test + end + + describe 'test an instance of AuthApi' do + it 'should create an instance of AuthApi' do + expect(@api_instance).to be_instance_of(OpenapiClient::AuthApi) + end + end + + # unit tests for test_auth_http_basic + # To test HTTP basic authentication + # To test HTTP basic authentication + # @param [Hash] opts the optional parameters + # @return [String] + describe 'test_auth_http_basic test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/api/body_api_spec.rb b/samples/client/echo_api/ruby-httpx/spec/api/body_api_spec.rb new file mode 100644 index 00000000000..cd346b568d5 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/api/body_api_spec.rb @@ -0,0 +1,118 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for OpenapiClient::BodyApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BodyApi' do + before do + # run before each test + @api_instance = OpenapiClient::BodyApi.new + end + + after do + # run after each test + end + + describe 'test an instance of BodyApi' do + it 'should create an instance of BodyApi' do + expect(@api_instance).to be_instance_of(OpenapiClient::BodyApi) + end + end + + # unit tests for test_binary_gif + # Test binary (gif) response body + # Test binary (gif) response body + # @param [Hash] opts the optional parameters + # @return [File] + describe 'test_binary_gif test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_body_application_octetstream_binary + # Test body parameter(s) + # Test body parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [File] :body + # @return [String] + describe 'test_body_application_octetstream_binary test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_body_multipart_formdata_array_of_binary + # Test array of binary in multipart mime + # Test array of binary in multipart mime + # @param files + # @param [Hash] opts the optional parameters + # @return [String] + describe 'test_body_multipart_formdata_array_of_binary test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_echo_body_free_form_object_response_string + # Test free form object + # Test free form object + # @param [Hash] opts the optional parameters + # @option opts [Object] :body Free form object + # @return [String] + describe 'test_echo_body_free_form_object_response_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_echo_body_pet + # Test body parameter(s) + # Test body parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :pet Pet object that needs to be added to the store + # @return [Pet] + describe 'test_echo_body_pet test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_echo_body_pet_response_string + # Test empty response body + # Test empty response body + # @param [Hash] opts the optional parameters + # @option opts [Pet] :pet Pet object that needs to be added to the store + # @return [String] + describe 'test_echo_body_pet_response_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_echo_body_tag_response_string + # Test empty json (request body) + # Test empty json (request body) + # @param [Hash] opts the optional parameters + # @option opts [Tag] :tag Tag object + # @return [String] + describe 'test_echo_body_tag_response_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/api/form_api_spec.rb b/samples/client/echo_api/ruby-httpx/spec/api/form_api_spec.rb new file mode 100644 index 00000000000..6d7be3056a4 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/api/form_api_spec.rb @@ -0,0 +1,66 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for OpenapiClient::FormApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'FormApi' do + before do + # run before each test + @api_instance = OpenapiClient::FormApi.new + end + + after do + # run after each test + end + + describe 'test an instance of FormApi' do + it 'should create an instance of FormApi' do + expect(@api_instance).to be_instance_of(OpenapiClient::FormApi) + end + end + + # unit tests for test_form_integer_boolean_string + # Test form parameter(s) + # Test form parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_form + # @option opts [Boolean] :boolean_form + # @option opts [String] :string_form + # @return [String] + describe 'test_form_integer_boolean_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_form_oneof + # Test form parameter(s) for oneOf schema + # Test form parameter(s) for oneOf schema + # @param [Hash] opts the optional parameters + # @option opts [String] :form1 + # @option opts [Integer] :form2 + # @option opts [String] :form3 + # @option opts [Boolean] :form4 + # @option opts [Integer] :id + # @option opts [String] :name + # @return [String] + describe 'test_form_oneof test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/api/header_api_spec.rb b/samples/client/echo_api/ruby-httpx/spec/api/header_api_spec.rb new file mode 100644 index 00000000000..47a146beb65 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/api/header_api_spec.rb @@ -0,0 +1,49 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for OpenapiClient::HeaderApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'HeaderApi' do + before do + # run before each test + @api_instance = OpenapiClient::HeaderApi.new + end + + after do + # run after each test + end + + describe 'test an instance of HeaderApi' do + it 'should create an instance of HeaderApi' do + expect(@api_instance).to be_instance_of(OpenapiClient::HeaderApi) + end + end + + # unit tests for test_header_integer_boolean_string + # Test header parameter(s) + # Test header parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_header + # @option opts [Boolean] :boolean_header + # @option opts [String] :string_header + # @return [String] + describe 'test_header_integer_boolean_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/api/path_api_spec.rb b/samples/client/echo_api/ruby-httpx/spec/api/path_api_spec.rb new file mode 100644 index 00000000000..5885056b53e --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/api/path_api_spec.rb @@ -0,0 +1,48 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for OpenapiClient::PathApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'PathApi' do + before do + # run before each test + @api_instance = OpenapiClient::PathApi.new + end + + after do + # run after each test + end + + describe 'test an instance of PathApi' do + it 'should create an instance of PathApi' do + expect(@api_instance).to be_instance_of(OpenapiClient::PathApi) + end + end + + # unit tests for tests_path_string_path_string_integer_path_integer + # Test path parameter(s) + # Test path parameter(s) + # @param path_string + # @param path_integer + # @param [Hash] opts the optional parameters + # @return [String] + describe 'tests_path_string_path_string_integer_path_integer test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/api/query_api_spec.rb b/samples/client/echo_api/ruby-httpx/spec/api/query_api_spec.rb new file mode 100644 index 00000000000..8c3e9dbfdb9 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/api/query_api_spec.rb @@ -0,0 +1,135 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for OpenapiClient::QueryApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'QueryApi' do + before do + # run before each test + @api_instance = OpenapiClient::QueryApi.new + end + + after do + # run after each test + end + + describe 'test an instance of QueryApi' do + it 'should create an instance of QueryApi' do + expect(@api_instance).to be_instance_of(OpenapiClient::QueryApi) + end + end + + # unit tests for test_enum_ref_string + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [StringEnumRef] :enum_ref_string_query + # @return [String] + describe 'test_enum_ref_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_query_datetime_date_string + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Time] :datetime_query + # @option opts [Date] :date_query + # @option opts [String] :string_query + # @return [String] + describe 'test_query_datetime_date_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_query_integer_boolean_string + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Integer] :integer_query + # @option opts [Boolean] :boolean_query + # @option opts [String] :string_query + # @return [String] + describe 'test_query_integer_boolean_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_query_style_deep_object_explode_true_object + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :query_object + # @return [String] + describe 'test_query_style_deep_object_explode_true_object test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_query_style_deep_object_explode_true_object_all_of + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter] :query_object + # @return [String] + describe 'test_query_style_deep_object_explode_true_object_all_of test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_query_style_form_explode_true_array_string + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] :query_object + # @return [String] + describe 'test_query_style_form_explode_true_array_string test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_query_style_form_explode_true_object + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [Pet] :query_object + # @return [String] + describe 'test_query_style_form_explode_true_object test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for test_query_style_form_explode_true_object_all_of + # Test query parameter(s) + # Test query parameter(s) + # @param [Hash] opts the optional parameters + # @option opts [DataQuery] :query_object + # @return [String] + describe 'test_query_style_form_explode_true_object_all_of test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/api_client_spec.rb b/samples/client/echo_api/ruby-httpx/spec/api_client_spec.rb new file mode 100644 index 00000000000..0fd815af5f2 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/api_client_spec.rb @@ -0,0 +1,190 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' + +describe OpenapiClient::ApiClient do + context 'initialization' do + context 'URL stuff' do + context 'host' do + it 'removes http from host' do + OpenapiClient.configure { |c| c.host = 'http://example.com' } + expect(OpenapiClient::Configuration.default.host).to eq('example.com') + end + + it 'removes https from host' do + OpenapiClient.configure { |c| c.host = 'https://wookiee.com' } + expect(OpenapiClient::ApiClient.default.config.host).to eq('wookiee.com') + end + + it 'removes trailing path from host' do + OpenapiClient.configure { |c| c.host = 'hobo.com/v4' } + expect(OpenapiClient::Configuration.default.host).to eq('hobo.com') + end + end + + context 'base_path' do + it "prepends a slash to base_path" do + OpenapiClient.configure { |c| c.base_path = 'v4/dog' } + expect(OpenapiClient::Configuration.default.base_path).to eq('/v4/dog') + end + + it "doesn't prepend a slash if one is already there" do + OpenapiClient.configure { |c| c.base_path = '/v4/dog' } + expect(OpenapiClient::Configuration.default.base_path).to eq('/v4/dog') + end + + it "ends up as a blank string if nil" do + OpenapiClient.configure { |c| c.base_path = nil } + expect(OpenapiClient::Configuration.default.base_path).to eq('') + end + end + end + end + + + + describe '#deserialize' do + it "handles Array" do + api_client = OpenapiClient::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '[12, 34]') + data = api_client.deserialize(response, 'Array') + expect(data).to be_instance_of(Array) + expect(data).to eq([12, 34]) + end + + it 'handles Array>' do + api_client = OpenapiClient::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '[[12, 34], [56]]') + data = api_client.deserialize(response, 'Array>') + expect(data).to be_instance_of(Array) + expect(data).to eq([[12, 34], [56]]) + end + + it 'handles Hash' do + api_client = OpenapiClient::ApiClient.new + headers = { 'Content-Type' => 'application/json' } + response = double('response', headers: headers, body: '{"message": "Hello"}') + data = api_client.deserialize(response, 'Hash') + expect(data).to be_instance_of(Hash) + expect(data).to eq(:message => 'Hello') + end + end + + describe "#object_to_hash" do + it 'ignores nils and includes empty arrays' do + # uncomment below to test object_to_hash for model + # api_client = OpenapiClient::ApiClient.new + # _model = OpenapiClient::ModelName.new + # update the model attribute below + # _model.id = 1 + # update the expected value (hash) below + # expected = {id: 1, name: '', tags: []} + # expect(api_client.object_to_hash(_model)).to eq(expected) + end + end + + describe '#build_collection_param' do + let(:param) { ['aa', 'bb', 'cc'] } + let(:api_client) { OpenapiClient::ApiClient.new } + + it 'works for csv' do + expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc') + end + + it 'works for ssv' do + expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc') + end + + it 'works for tsv' do + expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc") + end + + it 'works for pipes' do + expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc') + end + + it 'works for multi' do + expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc']) + end + + it 'fails for invalid collection format' do + expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID') + end + end + + describe '#json_mime?' do + let(:api_client) { OpenapiClient::ApiClient.new } + + it 'works' do + expect(api_client.json_mime?(nil)).to eq false + expect(api_client.json_mime?('')).to eq false + + expect(api_client.json_mime?('application/json')).to eq true + expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true + expect(api_client.json_mime?('APPLICATION/JSON')).to eq true + + expect(api_client.json_mime?('application/xml')).to eq false + expect(api_client.json_mime?('text/plain')).to eq false + expect(api_client.json_mime?('application/jsonp')).to eq false + end + end + + describe '#select_header_accept' do + let(:api_client) { OpenapiClient::ApiClient.new } + + it 'works' do + expect(api_client.select_header_accept(nil)).to be_nil + expect(api_client.select_header_accept([])).to be_nil + + expect(api_client.select_header_accept(['application/json'])).to eq('application/json') + expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + + expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml') + end + end + + describe '#select_header_content_type' do + let(:api_client) { OpenapiClient::ApiClient.new } + + it 'works' do + expect(api_client.select_header_content_type(nil)).to be_nil + expect(api_client.select_header_content_type([])).to be_nil + + expect(api_client.select_header_content_type(['application/json'])).to eq('application/json') + expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') + expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON') + expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml') + expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain') + end + end + + describe '#sanitize_filename' do + let(:api_client) { OpenapiClient::ApiClient.new } + + it 'works' do + expect(api_client.sanitize_filename('sun')).to eq('sun') + expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif') + expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif') + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/spec/configuration_spec.rb b/samples/client/echo_api/ruby-httpx/spec/configuration_spec.rb new file mode 100644 index 00000000000..a34a7e714fd --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/configuration_spec.rb @@ -0,0 +1,75 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' + +describe OpenapiClient::Configuration do + let(:config) { OpenapiClient::Configuration.default } + + before(:each) do + # uncomment below to setup host and base_path + # require 'URI' + # uri = URI.parse("http://localhost:3000") + # OpenapiClient.configure do |c| + # c.host = uri.host + # c.base_path = uri.path + # end + end + + describe '#base_url' do + it 'should have the default value' do + # uncomment below to test default value of the base path + # expect(config.base_url).to eq("http://localhost:3000") + end + + it 'should remove trailing slashes' do + [nil, '', '/', '//'].each do |base_path| + config.base_path = base_path + # uncomment below to test trailing slashes + # expect(config.base_url).to eq("http://localhost:3000") + end + end + end + + describe '#configure' do + let(:session) { HTTPX::Session.new } + + before do + module CustomPlugin + module InstanceMethods; end + end + module AnotherCustomPlugin + module InstanceMethods; end + end + + config.configure_session do |session| + session.plugin(CustomPlugin) + end + end + + it 'adds a block that will be used to configure the connection' do + sess = config.configure(session) + + expect(sess.class.ancestors).to include(CustomPlugin::InstanceMethods) + end + + it 'supports multiple configuration blocks' do + config.configure_session do |session| + session.plugin(AnotherCustomPlugin) + end + sess = config.configure(session) + + expect(sess.class.ancestors).to include(CustomPlugin::InstanceMethods) + expect(sess.class.ancestors).to include(AnotherCustomPlugin::InstanceMethods) + end + end +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/bird_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/bird_spec.rb new file mode 100644 index 00000000000..a7f2f46d85f --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/bird_spec.rb @@ -0,0 +1,42 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::Bird +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::Bird do + let(:instance) { OpenapiClient::Bird.new } + + describe 'test an instance of Bird' do + it 'should create an instance of Bird' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::Bird) + end + end + + describe 'test attribute "size"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "color"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/category_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/category_spec.rb new file mode 100644 index 00000000000..e52db312db6 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/category_spec.rb @@ -0,0 +1,42 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::Category +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::Category do + let(:instance) { OpenapiClient::Category.new } + + describe 'test an instance of Category' do + it 'should create an instance of Category' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::Category) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/data_query_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/data_query_spec.rb new file mode 100644 index 00000000000..91decf8c8d5 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/data_query_spec.rb @@ -0,0 +1,48 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::DataQuery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::DataQuery do + let(:instance) { OpenapiClient::DataQuery.new } + + describe 'test an instance of DataQuery' do + it 'should create an instance of DataQuery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::DataQuery) + end + end + + describe 'test attribute "suffix"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "text"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/default_value_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/default_value_spec.rb new file mode 100644 index 00000000000..79a3e1fdffa --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/default_value_spec.rb @@ -0,0 +1,82 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::DefaultValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::DefaultValue do + let(:instance) { OpenapiClient::DefaultValue.new } + + describe 'test an instance of DefaultValue' do + it 'should create an instance of DefaultValue' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::DefaultValue) + end + end + + describe 'test attribute "array_string_enum_ref_default"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "array_string_enum_default"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('Array', ["success", "failure", "unclassified"]) + # validator.allowable_values.each do |value| + # expect { instance.array_string_enum_default = value }.not_to raise_error + # end + end + end + + describe 'test attribute "array_string_default"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "array_integer_default"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "array_string"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "array_string_nullable"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "array_string_extension_nullable"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "string_nullable"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/number_properties_only_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/number_properties_only_spec.rb new file mode 100644 index 00000000000..44de02223da --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/number_properties_only_spec.rb @@ -0,0 +1,48 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::NumberPropertiesOnly +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::NumberPropertiesOnly do + let(:instance) { OpenapiClient::NumberPropertiesOnly.new } + + describe 'test an instance of NumberPropertiesOnly' do + it 'should create an instance of NumberPropertiesOnly' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::NumberPropertiesOnly) + end + end + + describe 'test attribute "number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "float"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "double"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/pet_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/pet_spec.rb new file mode 100644 index 00000000000..92371a30114 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/pet_spec.rb @@ -0,0 +1,70 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::Pet +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::Pet do + let(:instance) { OpenapiClient::Pet.new } + + describe 'test an instance of Pet' do + it 'should create an instance of Pet' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::Pet) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "photo_urls"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tags"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["available", "pending", "sold"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/query_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/query_spec.rb new file mode 100644 index 00000000000..4d4317c71bc --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/query_spec.rb @@ -0,0 +1,46 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::Query +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::Query do + let(:instance) { OpenapiClient::Query.new } + + describe 'test an instance of Query' do + it 'should create an instance of Query' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::Query) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "outcomes"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('Array', ["SUCCESS", "FAILURE", "SKIPPED"]) + # validator.allowable_values.each do |value| + # expect { instance.outcomes = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/string_enum_ref_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/string_enum_ref_spec.rb new file mode 100644 index 00000000000..3f51c331cbe --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/string_enum_ref_spec.rb @@ -0,0 +1,30 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::StringEnumRef +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::StringEnumRef do + let(:instance) { OpenapiClient::StringEnumRef.new } + + describe 'test an instance of StringEnumRef' do + it 'should create an instance of StringEnumRef' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::StringEnumRef) + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/tag_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/tag_spec.rb new file mode 100644 index 00000000000..e9ce719d4d4 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/tag_spec.rb @@ -0,0 +1,42 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::Tag +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::Tag do + let(:instance) { OpenapiClient::Tag.new } + + describe 'test an instance of Tag' do + it 'should create an instance of Tag' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::Tag) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_spec.rb new file mode 100644 index 00000000000..ac82b993db2 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_spec.rb @@ -0,0 +1,54 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter do + let(:instance) { OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.new } + + describe 'test an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' do + it 'should create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter) + end + end + + describe 'test attribute "size"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "color"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/models/test_query_style_form_explode_true_array_string_query_object_parameter_spec.rb b/samples/client/echo_api/ruby-httpx/spec/models/test_query_style_form_explode_true_array_string_query_object_parameter_spec.rb new file mode 100644 index 00000000000..073ceac8130 --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/models/test_query_style_form_explode_true_array_string_query_object_parameter_spec.rb @@ -0,0 +1,36 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter do + let(:instance) { OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.new } + + describe 'test an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' do + it 'should create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(OpenapiClient::TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) + end + end + + describe 'test attribute "values"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/echo_api/ruby-httpx/spec/spec_helper.rb b/samples/client/echo_api/ruby-httpx/spec/spec_helper.rb new file mode 100644 index 00000000000..cb59b02487e --- /dev/null +++ b/samples/client/echo_api/ruby-httpx/spec/spec_helper.rb @@ -0,0 +1,111 @@ +=begin +#Echo Server API + +#Echo Server API + +The version of the OpenAPI document: 0.1.0 +Contact: team@openapitools.org +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.1.0-SNAPSHOT + +=end + +# load the gem +require 'openapi_client' + +# The following was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end