Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apidoc openApi ecoscore mapping #11009

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api/ref/schemas/agribalyse.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
type: object
properties:
agribalyse_proxy_food_code:
type: string
agribalyse_food_code:
type: string
co2_agriculture:
Expand Down
82 changes: 82 additions & 0 deletions docs/api/ref/schemas/country-code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
openapi: 3.1.0
components:
schemas:
CountryCode:
type: string
enum:
&countryCodes [
shinjigi marked this conversation as resolved.
Show resolved Hide resolved
"ad",
"al",
"at",
"ax",
"ba",
"be",
"bg",
"ch",
"cy",
"cz",
"de",
"dk",
"dz",
"ee",
"eg",
"es",
"fi",
"fo",
"fr",
"gg",
"gi",
"gr",
"hr",
"hu",
"ie",
"il",
"im",
"is",
"it",
"je",
"lb",
"li",
"lt",
"lu",
"lv",
"ly",
"ma",
"mc",
"md",
"me",
"mk",
"mt",
"nl",
"no",
"pl",
"ps",
"pt",
"ro",
"rs",
"se",
"si",
"sj",
"sk",
"sm",
"sy",
"tn",
"tr",
"ua",
"uk",
"us",
"va",
"world",
"xk",
]
# patternProperties not supported by generators
#patternProperties:
# (?<country_code>\w\w):
# type: integer
CountryValues:
type: object
propertyNames:
$ref: "#/components/schemas/CountryCode"
additionalProperties:
type: number
default: 0
60 changes: 37 additions & 23 deletions docs/api/ref/schemas/product_ecoscore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ properties:
title: adjustments_origin_of_ingredient_aggregated
type: object
properties:
epi_score:
type: string #TODO: should be integer
origin:
type: string
percent:
type: integer
transportation_score:
type:
- "null"
- "integer"
epi_score:
type: integer
epi_value:
Expand All @@ -42,31 +48,18 @@ properties:
type: array
items:
type: string
transportation_score:
type: integer
transportation_scores:
type: object
properties:
world:
type: integer
patternProperties:
(?<country_code>\w\w):
type: integer
$ref: "./country-code.yaml#/components/schemas/CountryValues"
transportation_value:
type: integer
transportation_values:
type: object
properties:
world:
type: integer
patternProperties:
(?<country_code>\w\w):
type: integer

$ref: "./country-code.yaml#/components/schemas/CountryValues"
value:
type: integer
values:
type: object
properties:
world:
type: integer
patternProperties:
(?<country_code>\w\w):
type: integer
$ref: "./country-code.yaml#/components/schemas/CountryValues"
warning:
type: string
packaging:
Expand All @@ -88,6 +81,24 @@ properties:
type: string
shape:
type: string
number_of_units:
type: integer
examples: [1]
quantity_per_unit:
type: string
examples: ["33 cL"]
quantity_per_unit_unit:
type: string
examples: ["cl"]
quantity_per_unit_value:
type: number
examples: [33]
recycling:
type: string
examples: ["en:recycle-in-sorting-bin"]
weight_measured:
type: number
examples: [12.08]
score:
type: integer
value:
Expand All @@ -99,7 +110,10 @@ properties:
properties:
labels:
type: array
example: "vegan, fat free, Kosher"
examples:
- - vegan
- fat free
- Kosher
items:
type: string
value:
Expand Down
Loading