-
-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Improve api def ingredient schema (#10886)
This pull request updates the `ingredients.yaml` and `product_ingredients.yaml` file to improve the schema definitions and ensure conformity with OpenAPI 3.1 specification. Specifically, it includes: - Support better the self reference (SDK client gen compliant) correcting the `$ref` path for `ingredients`. - Added descriptions for properties. - Ensured all types are correct and conform to OpenAPI 3.1 specification.
- Loading branch information
Showing
8 changed files
with
91 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
$ref: ../schemas/nutrients.yaml | ||
$ref: '../schemas/nutrients.yaml#/components/schemas/Nutrients' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,43 @@ | ||
type: array | ||
description: | | ||
This structure gives the different ingredients and some information about them, | ||
like estimate on their quantity. | ||
items: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
ingredients: | ||
components: | ||
schemas: | ||
Ingredients: | ||
type: array | ||
description: | | ||
Sub ingredients composing this ingredients. | ||
# self recursive | ||
$ref: "#" | ||
percent: | ||
type: integer | ||
percent_estimate: | ||
type: | ||
- number | ||
percent_max: | ||
type: | ||
- number | ||
percent_min: | ||
type: integer | ||
text: | ||
type: string | ||
vegan: | ||
type: string | ||
vegetarian: | ||
type: string | ||
This structure gives the different ingredients and some information about them, | ||
like estimate on their quantity. | ||
items: | ||
type: object | ||
title: ingredient | ||
properties: | ||
id: | ||
type: string | ||
ingredients: | ||
description: | | ||
Sub ingredients composing this ingredients. | ||
# self recursive | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Ingredients/items' | ||
percent: | ||
type: integer | ||
description: The percentage of the ingredient. | ||
percent_estimate: | ||
type: number | ||
description: Estimated percentage of the ingredient. | ||
percent_max: | ||
type: | ||
- 'string' | ||
- 'number' | ||
description: Maximum percentage of the ingredient. | ||
percent_min: | ||
type: integer | ||
description: Minimum percentage of the ingredient. | ||
text: | ||
type: string | ||
description: Text description of the ingredient. | ||
vegan: | ||
type: string | ||
description: Indicates if the ingredient is vegan. | ||
vegetarian: | ||
type: string | ||
description: Indicates if the ingredient is vegetarian. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
type: array | ||
description: | | ||
Nutrients and sub-nutrients of a product, with their name and default unit. | ||
items: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
description: id of the nutrient | ||
name: | ||
type: string | ||
description: Name of the nutrient in the requested language | ||
important: | ||
type: boolean | ||
description: Indicates if the nutrient is always shown on the nutrition facts table | ||
display_in_edit_form: | ||
type: boolean | ||
description: Indicates if the nutrient should be shown in the nutrition facts edit form | ||
unit: | ||
description: Default unit of the nutrient | ||
$ref: "./nutrient_unit.yaml" | ||
nutrients: | ||
components: | ||
schemas: | ||
type: object | ||
Nutrients: | ||
type: array | ||
description: | | ||
Sub-nutrients (e.g. saturated-fat is a sub-nutrient of fat). | ||
# self recursive | ||
$ref: "#/" | ||
Nutrients and sub-nutrients of a product, with their name and default unit. | ||
(e.g. saturated-fat is a sub-nutrient of fat). | ||
items: | ||
type: object | ||
title: nutrient | ||
properties: | ||
id: | ||
type: string | ||
description: id of the nutrient | ||
name: | ||
type: string | ||
description: Name of the nutrient in the requested language | ||
important: | ||
type: boolean | ||
description: Indicates if the nutrient is always shown on the nutrition facts table | ||
display_in_edit_form: | ||
type: boolean | ||
description: Indicates if the nutrient should be shown in the nutrition facts edit form | ||
unit: | ||
description: Default unit of the nutrient | ||
$ref: "./nutrient_unit.yaml" | ||
nutrients: | ||
type: array | ||
items: | ||
# self recursive | ||
$ref: "#/components/schemas/Nutrients/items" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters