Update application/x-www-form-urlencoded serialization
- the application/x-www-form-urlencoded type is being serialized
as style=form, explode=true into simple key-value pairs composed
by '&' and encoded.
But each field inside the pair is being treated based on rules,
that depend on field DATA type. The rules are defined here:
https://spec.openapis.org/oas/v3.1.1.html#common-fixed-fields-0
See example of serialization + encoding here:
https://spec.openapis.org/oas/v3.1.1.html#example-url-encoded-form-with-json-values
- NOTE: {{isModel}} key is not applicable for {{formParams}}, because
fields are being flattened. But application/x-www-form-urlencoded is
a {{formParams}}, so I added a logic responsible for distinguishing
of models and primitive types.
- Added encoding.
- NOTE: application/x-www-form-urlencoded requires additional
encoding for " " and "+" symbols. Mentioned here:
https://spec.openapis.org/oas/v3.1.1.html#example-url-encoded-form-with-json-values
- Replaced usage of QMap<QString, QString> m_vars; variable to
'QUrlQuery m_queryItem;'. QUrlQuery class allows simplify key-value
pairs creation. See https://doc.qt.io/qt-6/qurlquery.html#details
- Added tests;
Change-Id: I7abf752cb178090b3ba08ad97bae8ae2af432032
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
| commit | 9398e1ee7e9523e23281e332514e824aab3b5791 |
| parent | 4ac0bdbe716e3ed483dae1b8b938be031bcbbe8e |
| author | Tatiana Borisova <tatiana.borisova@qt.io> |
| committer | Tatiana Borisova <tatiana.borisova@qt.io> |
| commit time | Fri, 15 Aug 2025 17:52:15 +0200 |
- M src/main/resources/cpp-qt6-client/HttpRequest.cpp.mustache
- M src/main/resources/cpp-qt6-client/HttpRequest.h.mustache
- M src/main/resources/cpp-qt6-client/api-body.mustache
- M src/main/resources/cpp-qt6-client/helpers-body.mustache
- M src/main/resources/cpp-qt6-client/helpers-header.mustache
- M tests/auto/colorpalette/client/client/OAIHelpers.cpp
- M tests/auto/colorpalette/client/client/OAIHelpers.h
- M tests/auto/colorpalette/client/client/OAIHttpRequest.cpp
- M tests/auto/colorpalette/client/client/OAIHttpRequest.h
- M tests/auto/colorpalette/qmlclient/client/OAIHelpers.cpp
- M tests/auto/colorpalette/qmlclient/client/OAIHelpers.h
- M tests/auto/colorpalette/qmlclient/client/OAIHttpRequest.cpp
- M tests/auto/colorpalette/qmlclient/client/OAIHttpRequest.h
- M tests/auto/mediatype/client/client/OAIHelpers.cpp
- M tests/auto/mediatype/client/client/OAIHelpers.h
- M tests/auto/mediatype/client/client/OAIHttpRequest.cpp
- M tests/auto/mediatype/client/client/OAIHttpRequest.h
- M tests/auto/mediatype/client/client/OAITestApi.cpp
- M tests/auto/mediatype/client/client/OAITestApi.h
- M tests/auto/mediatype/client/client/README.md
- M tests/auto/mediatype/client/mediatype/MediaType.cpp
- M tests/auto/mediatype/server/api/openapi.yaml
- M tests/auto/mediatype/server/go/api_test_.go
- M tests/auto/mediatype/server/go/routers.go
- M tests/auto/openapi2.0/client/client/OAIHelpers.cpp
- M tests/auto/openapi2.0/client/client/OAIHelpers.h
- M tests/auto/openapi2.0/client/client/OAIHttpRequest.cpp
- M tests/auto/openapi2.0/client/client/OAIHttpRequest.h
- M tests/auto/openapi2.0/server/go.mod
- M tests/auto/operation-parameters/client/client/OAIHelpers.cpp
- M tests/auto/operation-parameters/client/client/OAIHelpers.h
- M tests/auto/operation-parameters/client/client/OAIHttpRequest.cpp
- M tests/auto/operation-parameters/client/client/OAIHttpRequest.h
- M tests/auto/petstore/client/client/OAIHelpers.cpp
- M tests/auto/petstore/client/client/OAIHelpers.h
- M tests/auto/petstore/client/client/OAIHttpRequest.cpp
- M tests/auto/petstore/client/client/OAIHttpRequest.h
- M tests/auto/petstore/client/client/OAIPetApi.cpp
- M tests/auto/petstore/qmlclient/client/OAIHelpers.cpp
- M tests/auto/petstore/qmlclient/client/OAIHelpers.h
- M tests/auto/petstore/qmlclient/client/OAIHttpRequest.cpp
- M tests/auto/petstore/qmlclient/client/OAIHttpRequest.h
- M tests/auto/petstore/qmlclient/client/OAIPetApi.cpp
- M yaml_files/mediatype.yaml