-
Notifications
You must be signed in to change notification settings - Fork 9.1k
having problems with dict used in get requests #10404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @HamzaYslmn, We don't really know what API Description pydantic + fastapi code generates. If you could provide an actual generated API Description in JSON or YAML format, we would be able to determine if SwaggerUI is doing something problematic. Thanks! |
HERE: {
"openapi": "3.1.0",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/management": {
"get": {
"summary": "Get Ads",
"operationId": "get_ads_management_get",
"parameters": [
{
"name": "id",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Id"
}
},
{
"name": "title",
"in": "query",
"required": true,
"schema": {
"type": "string",
"title": "Title"
}
},
{
"name": "owner",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Owner"
}
},
{
"name": "doc_id",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "null"
}
],
"title": "Doc Id"
}
},
{
"name": "page",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"exclusiveMinimum": -1,
"default": 0,
"title": "Page"
}
},
{
"name": "filters",
"in": "query",
"required": false,
"schema": {
"anyOf": [
{
"type": "object",
"additionalProperties": true
},
{
"type": "null"
}
],
"example": {
"location": [
"Ankara",
"İstanbul"
],
"position_title": "Yazılım"
},
"title": "Filters"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
}
}
} |
YAML openapi: 3.1.0
info:
title: FastAPI
version: 0.1.0
paths:
/management:
get:
summary: Get Ads
operationId: get_ads_management_get
parameters:
- name: id
in: query
required: true
schema:
type: string
title: Id
- name: title
in: query
required: true
schema:
type: string
title: Title
- name: owner
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: Owner
- name: doc_id
in: query
required: false
schema:
anyOf:
- type: array
items:
type: string
- type: 'null'
title: Doc Id
- name: page
in: query
required: false
schema:
type: integer
exclusiveMinimum: -1
default: 0
title: Page
- name: filters
in: query
required: false
schema:
anyOf:
- type: object
additionalProperties: true
- type: 'null'
example:
location:
- Ankara
- "\u0130stanbul"
position_title: "Yaz\u0131l\u0131m"
title: Filters
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Q&A (please complete the following information)
Describe the bug you're encountering
having problems with dicts used in get requests
To reproduce...
Steps to reproduce the behavior:
write pydantic + fastapi code
Expected behavior
url should be:
localhost:8002/DB/ad/management?page=0&filters={"location": ["Ankara", "İstanbul"], "position_title": "Yazılım"}
not:
localhost:8002/DB/ad/management?page=0&location=["Ankara","İstanbul"]&position_title=Yazılım
filters missing.
Screenshots
The request is wrong, it's not usable.
The text was updated successfully, but these errors were encountered: