From d5c41980d6166ffcdff0bddebf9a6d4678b3f7dd Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Mon, 3 Jul 2023 13:44:57 +1000 Subject: [PATCH] Document example for updating SuppliedProduct --- .../spec/requests/supplied_products_spec.rb | 8 ++- swagger/dfc-v1.7/swagger.yaml | 62 ++++++++++++++++++- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/engines/dfc_provider/spec/requests/supplied_products_spec.rb b/engines/dfc_provider/spec/requests/supplied_products_spec.rb index c506869e22..b65622e963 100644 --- a/engines/dfc_provider/spec/requests/supplied_products_spec.rb +++ b/engines/dfc_provider/spec/requests/supplied_products_spec.rb @@ -113,10 +113,14 @@ describe "SuppliedProducts", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml put "Update SuppliedProduct" do consumes "application/json" - parameter name: :supplied_product, in: :body, schema: {} + parameter name: :supplied_product, in: :body, schema: { + example: ExampleJson.read("patch_supplied_product") + } let(:id) { variant.id } - let(:supplied_product) { ExampleJson.read("patch_supplied_product") } + let(:supplied_product) { |example| + example.metadata[:operation][:parameters].first[:schema][:example] + } response "401", "unauthorized" do before { login_as nil } diff --git a/swagger/dfc-v1.7/swagger.yaml b/swagger/dfc-v1.7/swagger.yaml index c7b5ebcb17..c0ef465254 100644 --- a/swagger/dfc-v1.7/swagger.yaml +++ b/swagger/dfc-v1.7/swagger.yaml @@ -374,6 +374,66 @@ paths: requestBody: content: application/json: - schema: {} + schema: + example: + "@context": + rdfs: http://www.w3.org/2000/01/rdf-schema# + skos: http://www.w3.org/2004/02/skos/core# + dfc: http://static.datafoodconsortium.org/ontologies/DFC_FullModel.owl# + dc: http://purl.org/dc/elements/1.1/# + dfc-b: http://static.datafoodconsortium.org/ontologies/DFC_BusinessOntology.owl# + dfc-p: http://static.datafoodconsortium.org/ontologies/DFC_ProductOntology.owl# + dfc-t: http://static.datafoodconsortium.org/ontologies/DFC_TechnicalOntology.owl# + dfc-m: http://static.datafoodconsortium.org/data/measures.rdf# + dfc-pt: http://static.datafoodconsortium.org/data/productTypes.rdf# + dfc-f: http://static.datafoodconsortium.org/data/facets.rdf# + dfc-p:hasUnit: + "@type": "@id" + dfc-b:hasUnit: + "@type": "@id" + dfc-b:hasQuantity: + "@type": "@id" + dfc-p:hasType: + "@type": "@id" + dfc-b:hasType: + "@type": "@id" + dfc-b:references: + "@type": "@id" + dfc-b:referencedBy: + "@type": "@id" + dfc-b:offeres: + "@type": "@id" + dfc-b:supplies: + "@type": "@id" + dfc-b:defines: + "@type": "@id" + dfc-b:affiliates: + "@type": "@id" + dfc-b:manages: + "@type": "@id" + dfc-b:offeredThrough: + "@type": "@id" + dfc-b:hasBrand: + "@type": "@id" + dfc-b:hasGeographicalOrigin: + "@type": "@id" + dfc-b:hasClaim: + "@type": "@id" + dfc-b:hasAllergenDimension: + "@type": "@id" + dfc-b:hasNutrimentDimension: + "@type": "@id" + dfc-b:hasPhysicalDimension: + "@type": "@id" + dfc:owner: + "@type": "@id" + dfc-t:hostedBy: + "@type": "@id" + dfc-t:hasPivot: + "@type": "@id" + dfc-t:represent: + "@type": "@id" + dfc-b:description: DFC-Pesto updated + dfc-b:quantity: 17 servers: - url: "/"