selectQueryOrMutationField seems not working #2921
-
I have REST api which I am trying to wrap in graphql using Graphql Mesh. Rest API have many POST methods which are in reality Query not Mutation. I did research and found that if I put below code it will move from Mutation to Query in yml. But seems like it is not doing anything. The post API is still under Mutation.
Complete code of .meshrc.yml
Dependencies
My Rest API swagger json
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Could you create a reproduction on CodeSandbox or maybe a failing test? Next time, please create an issue for bug reports instead of discussions. |
Beta Was this translation helpful? Give feedback.
-
Hi @AndroidHitchhiking , Thanks for sharing the swagger json, which is very useful. I believe the issue is that you're not using the correct title. In addition to this, you're setting "method" as a key, whilst instead, it should be "title". I believe that you need to change your config to this: selectQueryOrMutationField:
- title: "Api Documentation"
path: /ContentList/CommunicationNotification
method: post
type: Query |
Beta Was this translation helpful? Give feedback.
-
Hi @santino, I'm having a similar issue with // .meshrc.ts
handler: {
openapi: {
endpoint: process.env.destination_url,
source: `${process.env.destination_url}/swagger/docs.yaml`,
selectQueryOrMutationField: [{ type: 'Query', fieldName: 'projectVersions' }],
},
}, # /swagger/docs.yaml
/projects/{projectId}/versions:
post:
summary: Requested project versions
description: Requested project versions for projectId
operationId: project versions
parameters:
- name: Token
in: header
required: true
schema:
type: string
- name: projectId
in: path
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/AuditQueryRequestBody'
required: true
responses:
'200':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/GetProjectVersionsResponse'
'400':
description: Invalid Input
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorMessage'
'500':
description: Internal Error
content:
application/json:
schema:
$ref: '#/components/schemas/DetailedErrorMessage' on the documentation is says that the |
Beta Was this translation helpful? Give feedback.
Hi @AndroidHitchhiking ,
Thanks for sharing the swagger json, which is very useful.
I believe the issue is that you're not using the correct title.
From Swagger specs I see that the OAS title is "Api Documentation", you are instead using "getCommunicationNotification".
In addition to this, you're setting "method" as a key, whilst instead, it should be "title".
I believe that you need to change your config to this: