Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !7415

[ruby] Support for per-operation servers

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jirikuncar/ruby/dynamic-servers into master 4 years ago
  • Overview 0
  • Commits 6
  • Pipelines 0
  • Changes 49

Created by: jirikuncar

Adds support for configurable servers per operation.

Related PRs for other languages

  • Python https://github.com/OpenAPITools/openapi-generator/pull/6557
  • Go https://github.com/OpenAPITools/openapi-generator/pull/4755

Addresses #590

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
Compare
  • master (base)

and
  • latest version
    767cadea
    6 commits, 2 years ago

49 files
+ 2315
- 26

    Preferences

    File browser
    Compare changes
bin/c‎onfigs‎
ruby-features-dyn‎amic-servers.yaml‎ +9 -0
modules/openapi-g‎enerator/src/main‎
java/org/openapitoo‎ls/codegen/languages‎
RubyClientC‎odegen.java‎ +3 -1
resources/‎ruby-client‎
api.mu‎stache‎ +1 -0
api_clien‎t.mustache‎ +2 -2
api_client_farada‎y_partial.mustache‎ +1 -1
api_client_typhoeu‎s_partial.mustache‎ +1 -1
configurati‎on.mustache‎ +73 -5
sam‎ples‎
client/‎petstore‎
ruby-faraday‎/lib/petstore‎
a‎pi‎
another_f‎ake_api.rb‎ +1 -0
default‎_api.rb‎ +1 -0
fake_‎api.rb‎ +15 -0
fake_classname‎_tags123_api.rb‎ +1 -0
pet_a‎pi.rb‎ +9 -0
store_‎api.rb‎ +4 -0
user_‎api.rb‎ +8 -0
api_cl‎ient.rb‎ +3 -3
configur‎ation.rb‎ +52 -5
ruby/lib‎/petstore‎
a‎pi‎
another_f‎ake_api.rb‎ +1 -0
default‎_api.rb‎ +1 -0
fake_‎api.rb‎ +15 -0
fake_classname‎_tags123_api.rb‎ +1 -0
pet_a‎pi.rb‎ +9 -0
store_‎api.rb‎ +4 -0
user_‎api.rb‎ +8 -0
api_cl‎ient.rb‎ +3 -3
configur‎ation.rb‎ +52 -5
openapi3/client/…/d‎ynamic-servers/ruby‎
.openapi-‎generator‎
FI‎LES‎ +20 -0
VER‎SION‎ +1 -0
do‎cs‎
Usage‎Api.md‎ +96 -0
l‎ib‎
dynamic‎_servers‎
a‎pi‎
usage_‎api.rb‎ +136 -0
api_cl‎ient.rb‎ +387 -0
api_er‎ror.rb‎ +57 -0
configur‎ation.rb‎ +352 -0
versi‎on.rb‎ +15 -0
dynamic_s‎ervers.rb‎ +40 -0
sp‎ec‎
a‎pi‎
usage_ap‎i_spec.rb‎ +57 -0
api_clien‎t_spec.rb‎ +226 -0
base_url‎_spec.rb‎ +71 -0
configurat‎ion_spec.rb‎ +42 -0
spec_he‎lper.rb‎ +111 -0
.giti‎gnore‎ +39 -0
.openapi-gen‎erator-ignore‎ +23 -0
.rs‎pec‎ +2 -0
.ruboc‎op.yml‎ +148 -0
.trav‎is.yml‎ +11 -0
Gem‎file‎ +9 -0
READ‎ME.md‎ +88 -0
Rake‎file‎ +10 -0
dynamic_ser‎vers.gemspec‎ +38 -0
git_p‎ush.sh‎ +58 -0
bin/configs/ruby-features-dynamic-servers.yaml 0 → 100644
+ 9
- 0
  • View file @ 767cadea

  • Edit in single-file editor

  • Open in Web IDE

generatorName: ruby
outputDir: samples/openapi3/client/features/dynamic-servers/ruby/
inputSpec: modules/openapi-generator/src/test/resources/3_0/features/dynamic-servers.yaml
templateDir: modules/openapi-generator/src/main/resources/ruby-client
additionalProperties:
gemVersion: 1.0.0
moduleName: DynamicServers
gemName: dynamic_servers
skipFormModel: "true"
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java
+ 3
- 1
  • View file @ 767cadea

  • Edit in single-file editor

  • Open in Web IDE


@@ -83,7 +83,9 @@ public class RubyClientCodegen extends AbstractRubyCodegen {
GlobalFeature.XMLStructureDefinitions,
GlobalFeature.Callbacks,
GlobalFeature.LinkObjects,
GlobalFeature.ParameterStyling
GlobalFeature.ParameterStyling,
GlobalFeature.ParameterizedServer,
GlobalFeature.MultiServer
)
.includeSchemaSupportFeatures(
SchemaSupportFeature.Polymorphism
modules/openapi-generator/src/main/resources/ruby-client/api.mustache
+ 1
- 0
  • View file @ 767cadea

  • Edit in single-file editor

  • Open in Web IDE


@@ -182,6 +182,7 @@ module {{moduleName}}
auth_names = opts[:auth_names] || [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}]
new_options = opts.merge(
:operation => :"{{classname}}.{{operationId}}",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache
+ 2
- 2
  • View file @ 767cadea

  • Edit in single-file editor

  • Open in Web IDE


@@ -177,10 +177,10 @@ module {{moduleName}}
filename.gsub(/.*[\/\\]/, '')
end
def build_request_url(path)
def build_request_url(path, opts = {})
# Add leading and trailing slashes to path
path = "/#{path}".gsub(/\/+/, '/')
@config.base_url + path
@config.base_url(opts[:operation]) + path
end
# Update hearder and query params based on authentication settings.
modules/openapi-generator/src/main/resources/ruby-client/api_client_faraday_partial.mustache
+ 1
- 1
  • View file @ 767cadea

  • Edit in single-file editor

  • Open in Web IDE


@@ -63,7 +63,7 @@
# @option opts [Object] :body HTTP body (JSON/XML)
# @return [Typhoeus::Request] A Typhoeus Request
def build_request(http_method, path, request, opts = {})
url = build_request_url(path)
url = build_request_url(path, opts)
http_method = http_method.to_sym.downcase
header_params = @default_headers.merge(opts[:header_params] || {})
Assignee
Jim Schubert's avatar
Jim Schubert
Assign to
0 Reviewers
None
Request review from
Labels
2
Client: Ruby Feature: OAS 3.0 spec support
2
Client: Ruby Feature: OAS 3.0 spec support
    Assign labels
  • Manage project labels

Milestone
5.0.0
5.0.0 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
2
2 participants
Jim Schubert
Administrator
Reference: OpenAPITools/openapi-generator!7415
Source branch: github/fork/jirikuncar/ruby/dynamic-servers

Menu

Explore Projects Groups Snippets