openapi-to-graphql icon indicating copy to clipboard operation
openapi-to-graphql copied to clipboard

DELETE method endpoints are missing in generated Graphql schema

Open anuraggo opened this issue 4 years ago • 3 comments

Hello,

While converting to graphql, I see that only GET and POST method endpoints are available in graphql schema and DELETE endpoints are missing. Please assist on how to get all the endpoints in generated schema.

anuraggo avatar Jun 24 '21 12:06 anuraggo

@anuraggo Sorry for the late reply. This is very interesting. I will need to verify this issue but my first thought is that perhaps this is an issue with a DELETE operation not having a response schema, which would result in skipping the operation.

Do you have a sample OAS for me to try?

Alan-Cha avatar Jul 01 '21 18:07 Alan-Cha

Hi @Alan-Cha ,

Yes, you're right. The DELETE operation doesn't have response schema. Still I would think that library should have an option to generate endpoints for this case where there is no response schema. Let me know your thoughts on this.

delete: tags: - Trouble Ticket summary: (Internal) Deletes a 'TroubleTicket' by identifier. description: Deletes a 'TroubleTicket' by identifier. operationId: deleteTroubleTicket parameters: - name: Accept-Language in: header description: | Locale of the client required: false type: string - name: troubleTicketId in: path description: Identifier of the Trouble Ticket. required: true type: string - name: If-Match in: header description: "description" required: false type: string responses: "204": description: No content. "400": description: | Bad Request - The server cannot process the request due to a malformed syntax. The response can be caused by missing mandatory query parameters, invalid value in the query parameters, validation exceptions, and so on. schema: $ref: '#/definitions/Error' "401": description: | Unauthorized - The server cannot apply the request because it lacks valid authentication credentials for the target resource. schema: $ref: '#/definitions/Error' "404": description: | Not Found - The server did not find anything matching the request URI. schema: $ref: '#/definitions/Error' "500": description: | Internal Server Error - The server encountered an unexpected condition that prevented it from fulfilling the request. schema: $ref: '#/definitions/Error' x-dox-Microservice: ticket-ticketentity-app-id x-dox-InternalAPI: true x-amdocs: route-service: ticket-ticketentity-service private-roles: - D1P_TroubleTicket_delete

anuraggo avatar Jul 02 '21 04:07 anuraggo

You can solve it by setting this property: fillEmptyResponses:true

openapiToGraphql.createGraphQLSchema(oas, {
  viewer: false,
  fillEmptyResponses: true,
})

hongdeyuan avatar Aug 19 '21 09:08 hongdeyuan