-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
docs: YAML syntax in the data schema files #11220
Conversation
========================================== This pull request applies to files ``` docs/api/ref/schemas/api.yaml docs/api/ref/schemas/ecoscore-country-code.yaml docs/api/ref/schemas/product-nutriscore.yaml docs/api/ref/schemas/product-nutristion.yaml ``` Multi-line string ----------------- The `api.yaml` file contains the following specification: ``` components: securitySchemes: [ ... cut ... ] userAgentAuth: description: Authentication using User-Agent header User-Agent header in the format 'app_name/app_version (email)' type: apiKey in: header name: User-Agent ``` The description of `userAgentAuth` spans two lines, so it should be written as: ``` components: securitySchemes: [ ... cut ... ] userAgentAuth: description: | Authentication using User-Agent header User-Agent header in the format 'app_name/app_version (email)' type: apiKey in: header name: User-Agent ``` Array in JSON syntax -------------------- In a YAML file, an array can use the YAML syntax, i.e. each item on a separate line, with a dash prefix at a constant indent level, or use the JSON syntax, i.e. all items separated with a comma and the whole list enclose dwithin square brackets. Yet, with the `YAML.pm` Perl module, a JSON-syntax list should be on a single line. A multi-line JSON syntax triggers an error. Therefore the lists: ``` components: schemas: EcoscoreCountryCode: type: string enum: [ "ad", "al", "at", [ ... cut ... ] "world", "xk", ] ``` and ``` id: type: string examples: [ "energy", "sugars", "saturated_fat", "salt", "fiber", "fruits_vegetables_legumes", ] ``` and ``` type: string enum: [ "公斤", "公升", "kg", "кг", "l", "л", [ ... cut ... ] "gpg", ] ``` should be written as a single JSON line (rather cumbersome in two cases, not tested in the third case) ``` id: type: string examples: [ "energy", "sugars", "saturated_fat", "salt", "fiber", "fruits_vegetables_legumes" ] ``` or with the YAML syntax (better): ``` components: schemas: EcoscoreCountryCode: type: string enum: - "ad" - "al" - "at" [ ... cut ... ] - "world" - "xk" ``` and ``` id: type: string examples: - "energy" - "sugars" - "saturated_fat" - "salt" - "fiber" - "fruits_vegetables_legumes" ``` and ``` type: string enum: - "公斤" - "公升" - "kg" - "кг" - "l" - "л" [ ... cut ... ] - "gpg" ``` Happy new year!
Quality Gate passedIssues Measures |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11220 +/- ##
=======================================
Coverage 49.22% 49.22%
=======================================
Files 78 78
Lines 22405 22405
Branches 5374 5374
=======================================
Hits 11028 11028
Misses 10020 10020
Partials 1357 1357 ☔ View full report in Codecov by Sentry. |
Please disregard this pull request. After checking the YAML files with Perl module YAML.pm 1.31, I havec Therefore, I will switch to YAML::XS and close the pull request. Sorry for the noise. |
docs: YAML syntax in the data schema files
This pull request applies to files
Multi-line string
The
api.yaml
file contains the following specification:The description of
userAgentAuth
spans two lines, so it should be written as:Array in JSON syntax
In a YAML file, an array can use the YAML syntax, i.e. each item on a separate line, with a dash prefix at a constant indent level, or use the JSON syntax, i.e. all items separated with a comma and the whole list enclose dwithin square brackets. Yet, with the
YAML.pm
Perl module, a JSON-syntax list should be on a single line. A multi-line JSON syntax triggers an error.Therefore the lists:
and
and
should be written as a single JSON line (rather cumbersome in two cases, not tested in the third case)
or with the YAML syntax (better):
and
and
Happy new year!