diff --git a/examples/fastify/.meshrc.yml b/examples/fastify/.meshrc.yml index 4b528585e71c1..fd50928942fab 100644 --- a/examples/fastify/.meshrc.yml +++ b/examples/fastify/.meshrc.yml @@ -1,3 +1,4 @@ +merger: bare sources: - name: Swapi handler: @@ -5,3 +6,14 @@ sources: source: ./swagger/pets.json endpoint: >- http://localhost:4001 + selectQueryOrMutationField: + - fieldName: post_pet_by_petId + type: query + transforms: + - filterSchema: + mode: bare + filters: + - Mutation.!* + - extend: + typeDefs: ./src/extensions/typeDefs.graphql + resolvers: ./src/extensions/resolvers diff --git a/examples/fastify/src/extensions/resolvers.ts b/examples/fastify/src/extensions/resolvers.ts new file mode 100644 index 0000000000000..610bfd0145c0f --- /dev/null +++ b/examples/fastify/src/extensions/resolvers.ts @@ -0,0 +1,7 @@ +const resolvers = { + Pet: { + fullName: () => "full name" + } +} + +export default resolvers; diff --git a/examples/fastify/src/extensions/typeDefs.graphql b/examples/fastify/src/extensions/typeDefs.graphql new file mode 100644 index 0000000000000..d5530006e6e40 --- /dev/null +++ b/examples/fastify/src/extensions/typeDefs.graphql @@ -0,0 +1,3 @@ +extend type Pet { + fullName: String +} diff --git a/examples/fastify/swagger/pets.json b/examples/fastify/swagger/pets.json index f07d6d5dbe758..7dbb8a75072f8 100644 --- a/examples/fastify/swagger/pets.json +++ b/examples/fastify/swagger/pets.json @@ -2,7 +2,34 @@ "openapi": "3.0.3", "paths": { "/pet/{petId}": { - "get": { + "post": { + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet to return", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + } + } + } + } + }, + "/pet2/{petId}": { + "post": { "parameters": [ { "name": "petId",