body type mismatch
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 38/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- Python
- Sterne
- 2k
- Forks
- 293
- Ø Merge
- 34 Min.
- Gemergte PRs (30 T.)
- 1
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus openapi-generators/openapi-python-client
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
openapi-generators/openapi-python-client#1451 · 1 Kommentar ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 64/100
openapi-generators/openapi-python-client#1435 · 1 Kommentar ·
Alle Issues in openapi-generators/openapi-python-client
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
anthropics/skills#1811 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
speaches-ai/speaches#678 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
datalayer/mcp-compose#42 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
conda-forge/spacy-feedstock#177 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
UKGovernmentBEIS/inspect_evals#2523 ·