Description
I wrote a yaml following OAS 3.0, its servers part looked like this:
...
#--- server ---#servers:
# server object
- url: http://1.1.1.1:9200/
- url: http://1.1.1.1:9201/v2
...
I used this yaml generating python code, and didn' t see the second url('http://1.1.1.1:9201/v2')
So, my question is: What is the desired result if the yaml contains multiple urls?
openapi-generator version
I installed openapi-generator using Homebrew yesterday.
OpenAPI declaration file content or url
#--- OpenAPI version ---#openapi: '3.0.0'#--- metadata about the api ---#info:
# title of the applicationtitle: '9'# description of the applicationdescription: '9'# terms of service for the API, must be a URLtermsOfService: ''# contact information for the exposed APIcontact:
name: 'myname'url: 'myurl'email: 'my@mail.com'# license information for the exposed APIlicense:
name: 'myname'url: 'myurl'# version of the OpenAPI documentversion: '1.0.1'#--- additional external documentation ---#externalDocs:
description: '9'url: ''#--- server ---#servers:
# server object
- url: http://1.1.1.1:9200/
- url: http://1.1.1.1:9201/v2# URL to the target host# map between a variable name and its value(used for substitution in the server's URL template)variables:
basePath:
enum:
- ''
- 'website/face/v2/'
- 'business/api/'default: ''description: 'basePath'username:
default: 'admin'description: 'username'description: 's'#--- tags for specification with additional metadata ---#tags:
- name: 'website'description: 'API of website operations'security:
# only one of the security requirement objects need to be satisfied to authorize a request# mentioned names must in components-seuritySchemes
-
cookieAuth_sessionId: []cookieAuth_ytClusterId: []# lists the required security schemes to execute this operation# objects that contain multiple schemes require all satisfication#--- reusable objects for the specification ---#components:
# Security scheme definitions (see Authentication)securitySchemes:
# https://swagger.io/specification/#securitySchemeObjectcookieAuth_sessionId:
type: 'apiKey'in: 'cookie'name: 'session_id'cookieAuth_ytClusterId:
type: 'apiKey'in: 'cookie'name: 'yt_cluster_id'# Reusable schemas (data models)schemas:
# definition of input and output data types# can be objects, primitives, arrays# https://swagger.io/specification/#schemaObjectsessionID:
type: 'string'clusterID:
type: 'string'# user login info: name & passwordLoginInfo:
type: 'object'required:
- name
- passwordproperties:
name:
type: 'string'password:
type: 'string'# password should be a md5 format stringLoginResponseInfo:
type: 'object'required:
- session_idproperties:
session_id:
type: 'string'cluster_id:
type: 'string'# response info for all API: rtn & messageResponseInfo:
type: 'object'required:
- rtn
- messageproperties:
rtn:
type: 'integer'# format: 'int32'message:
type: 'string'# repository info for creation: repository name and extra_metarepoCreationInfo:
type: 'object'required:
- nameproperties:
name:
type: 'string'extra_meta:
type: 'object'additionalProperties: {}# or can be written as: additionalProperties: true# repository id inforepoIdInfo:
type: 'object'required:
- idproperties:
id:
type: 'string'# Reusable request bodiesrequestBodies:
LoginBody:
description: 'A JSON object containing the login and password'required: truecontent:
'application/json':
schema:
$ref: '#/components/schemas/LoginInfo'# examples:# LoginInfo_admin:# $ref: '#/components/examples/LoginInfo_example'repoCreationBody:
description: 'A JSON object containing the repository name and meta info'required: truecontent:
'application/json':
schema:
$ref: '#/components/schemas/repoCreationInfo'# Reusable responses, such as 401 Unauthorized or 400 Bad Requestresponses:
# default response modelDefaultResponse:
description: 'Error: rtn != 0'headers: ''content:
'application/json':
schema:
$ref: '#/components/schemas/ResponseInfo'# successful login response modelLoginResponse:
description: 'Successful login: The session ID is returned in a cookie named `session_id` and you need to include this cookie in subsequent requests'headers:
Set-cookie:
schema:
allOf:
- $ref: '#/components/schemas/sessionID'
- $ref: '#/components/schemas/clusterID'# type: 'string'# example: 'session_id=111@DEFAULT; yt_cluster_id=DEFAULT'content:
'application/json':
schema:
anyOf:
- $ref: '#/components/schemas/ResponseInfo'
- $ref: '#/components/schemas/LoginResponseInfo'repoCreationResponse:
description: 'Successful repo_creation'content:
'application/json':
schema:
anyOf:
- $ref: '#/components/schemas/ResponseInfo'
- $ref: '#/components/schemas/repoIdInfo'#--- available paths and operations for the API ---#paths:
# path for user login/login:
post:
tags:
# - 'user'
- 'business'summary: 'user login'description: 'user login with user name and password'operationId: 'userLogin'requestBody:
$ref: '#/components/requestBodies/LoginBody'responses:
'200':
$ref: '#/components/responses/LoginResponse''default':
$ref: '#/components/responses/DefaultResponse'deprecated: falsesecurity: [] # no authorization for login operationexternalDocs:
description: 'API document for business user login'url: ''# path about repository operations/repository:
summary: 'repository related operations'description: 'Operations: create/update/delete/query repository'# POST operationpost:
# tags for API documentation controltags:
# - 'repository'
- 'business'# short summary about what the operation doessummary: 'create new repository'# verbose explanation of the operation behaviordescription: 'create new repository with certain repository name'# Additional external documentation for this operationexternalDocs:
description: 'API document for repository creation'url: ''# unique string to identify the operationoperationId: 'repositoryCreation'# request body,only supported in HTTPrequestBody:
$ref: '#/components/requestBodies/repoCreationBody'# list of possible responses as they are returned from executing this operationresponses:
'200':
$ref: '#/components/responses/repoCreationResponse''default':
$ref: '#/components/responses/DefaultResponse'Command line used for generation
openapi-generator generate -i swagger.yaml -g python -o /tmp/test/python-3
Steps to reproduce
Running the command above is enough.
Description
I wrote a yaml following OAS 3.0, its servers part looked like this:
I used this yaml generating python code, and didn' t see the second url('http://1.1.1.1:9201/v2')
So, my question is: What is the desired result if the yaml contains multiple urls?
openapi-generator version
I installed openapi-generator using Homebrew yesterday.
OpenAPI declaration file content or url
Command line used for generation
openapi-generator generate -i swagger.yaml -g python -o /tmp/test/python-3Steps to reproduce
Running the command above is enough.