Proposed change for new api-client syntax regarding query params #574
Closed
niklaswolf
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
as with #871 - query params are now removed from the path definitions. The only variables that stays are pathParams. All other params, endpoint headers or body are added in type definitions. Example definition of the kind of endpoint: export type operations = {
// ....
"readCategory post /category/{navigationId}": {
contentType?: "application/json";
accept?: "application/json";
headers?: {
/** Instructs Shopware to try and resolve SEO URLs for the given navigation item */
"sw-include-seo-urls"?: boolean; // TODO: [OpenAPI][readCategory] - add header to the parameters
};
query?: {
/** Resolves only the given slot identifiers. The identifiers have to be seperated by a '|' character */
slots?: string;
};
pathParams: {
/** Identifier of the category to be fetched */
navigationId: string;
};
body: components["schemas"]["Criteria"] &
components["schemas"]["ProductListingCriteria"];
response: components["schemas"]["Category"];
responseCode: 200;
};
//....
} and the invocation looks like const result = await apiClient.invoke(
"readCategory post /category/{navigationId}",
{
pathParams: {
navigationId: categoryId,
},
headers: {
"sw-include-seo-urls": true,
},
body: {
// some criteria
},
},
); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While moving to the new API-client we stumbled upon the syntax how to "declare" query params.
Currently you have to do it like this:
We'd like to propose changing it to the following syntax:
Advantages:
{}
, e.g./document/download/{documentId}/{deepLinkCode}
Disadvantages:
Beta Was this translation helpful? Give feedback.
All reactions