我想部署一个具有查询字符串的API.这是API
v1/products?q=circuit breaker&locale=en-GB&pageSize=8&pageNo=1&project=GLOBAL
Run Code Online (Sandbox Code Playgroud)
以下是我的实施方式
"/v1/products?q={searchText}&locale={ctrCode}&pageSize={pageSize}&pageNo={pageNo}&project={project}&country={country}":{
"get":{
"tags":[
"Search Text"
],
"summary":"Get Products by searching text, countrycode, page number, pagesize, project and country(optional)",
"description":"Get Products by searching text, countrycode, page number, pagesize, project and country(optional)",
"operationId":"getProductName",
"produces":[
"application/json",
"application/xml"
],
"parameters":[
{
"name":"searchText",
"in":"path",
"description":"The Product that needs to be fetched",
"required":true,
"type":"string"
},
{
"name":"ctrCode",
"in":"path",
"description":"The Product locale needs to be fetched. Example=en-GB, fr-FR, etc.",
"required":true,
"type":"string"
},
{
"name":"pageSize",
"in":"path",
"description":"The Product PageSize that needs to be fetched. …Run Code Online (Sandbox Code Playgroud) 我在 SwaggerHub 注册并使用 OpenAPI 3.0 创建了一个新的 API。在我的 API 中,/tasks路径有 2 个非必需参数,但我无法将它们设置为非必需 - 编辑器显示“不允许的值”错误。
这是我的 API 定义:
openapi: 3.0.0
info:
description: A Simple IP Address API
title: VTasks
version: v1
servers:
# Added by API Auto Mocking Plugin
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/petrogromovo/Vtasks/1.0.0
- description: SwaggerHub API Auto Mocking
url: http://hosting.tk
paths:
/tasks:
get:
tags:
- tasks
summary: Get paginated / filtered tasks listing
operationId: tasks
parameters:
- name: page
in: path
description: The page number …Run Code Online (Sandbox Code Playgroud)