body type mismatch
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 38/100
Direção de pesquisa
Start with the generated _get_kwargs method and trace the arguments and body_to_kwarg macros, especially how endpoint.bodies[0].prop.get_type_string() differs from body.body_type. Review the application/x-www-form-urlencoded BodyType mapping and verify that a binary body no longer attempts to access .to_dict.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
In the _get_kwargs generated method, the body is determined as File type (because the format in my swagger definition is binary), but it tries to access its .to_dict attribute (because body_type is considered as data due to the content type application/x-www-form-urlencoded), which does not exist because it is a file
OpenAPI Spec File
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"description": "do stuff",
"type": "string",
"format": "binary"
}
}
}
Desktop (please complete the following information):
- OS: macOS 13.3.1
- Python Version: 3.9.8
- openapi-python-client version: 0.17.2
Additional context
In the macro, the arguments macro determine the argument type of body based on endpoint.bodies[0].prop.get_type_string(), whereas in the body_to_kwarg macro it determines it based on body.body_type, which is determined by the following:
if simplified_content_type == "application/x-www-form-urlencoded":
body_type = BodyType.DATA
elif simplified_content_type == "multipart/form-data":
body_type = BodyType.FILES
elif simplified_content_type == "application/octet-stream":
body_type = BodyType.CONTENT
elif simplified_content_type == "application/json" or simplified_content_type.endswith("+json"):
body_type = BodyType.JSON
- Linguagem predominante
- Python
- Estrelas
- 2k
- Forks
- 293
- Merge médio
- 34min
- PRs com merge (30d)
- 1
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de openapi-generators/openapi-python-client
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 72/100
openapi-generators/openapi-python-client#1451 · 1 comentário ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 52/100
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 64/100
openapi-generators/openapi-python-client#1435 · 1 comentário ·
Todas as issues de openapi-generators/openapi-python-client
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
anthropics/skills#1811 · 1 comentário ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
speaches-ai/speaches#678 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
datalayer/mcp-compose#42 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
conda-forge/spacy-feedstock#177 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
UKGovernmentBEIS/inspect_evals#2523 ·