Spiciness:
description: Description not available
enum:
- Hot
- Medium
- Mild
type: string
but without the current changes, it looks like:
Spiciness:
description: Description not available
example:
value:
id: some_id
properties:
isSpicierThan:
description: Description not available
items:
$ref: "#/components/schemas/Spiciness"
nullable: true
type: array
description:
description: small description
items:
type: string
nullable: true
type: array
id:
description: identifier
nullable: false
type: string
label:
description: short description of the resource
items:
type: string
nullable: true
type: array
type:
description: type of the resource
items:
type: string
nullable: true
type: array
type: object
You can see that not only is the enum aspect of this defined class lost in the yaml output, but the individual enum values are also missing completely.
As I was making the necessary changes to support enums (based on the owl:oneOf restrictions mentioned above), I made a handful of other cleanup changes. Apologies in advance if this makes reviewing difficult.
The cleanup changes included:
wrapping one line statements (e.g. if, for, etc.) within curly braces. (More for safety and a little bit for readability)
making some whitespace consistent (e.g. one space between method declaration and the { that follows)
adding this. when I noticed a class variable is being used. (good practice, but also readability)
replacing .size() == 0 or .size() !=0 with .isEmpty() or ! ... .isEmpty().
removing random whitespace at the end of a line
I will make a future PR to try and make all of the formatting consistent throughout (but without any functional changes). These formatting updates were mostly localized to where I was already making other changes OR easy to identify/fix.
Enums are not output to .yaml currently. This PR aims to fix that.
For example, the Turtle snippet below from the Pizza Tutorial does not produce an enum for Spiciness which contains the values
Hot
,Medium
, andMild
:The expected output for this schema should be:
but without the current changes, it looks like:
You can see that not only is the enum aspect of this defined class lost in the yaml output, but the individual enum values are also missing completely.
As I was making the necessary changes to support enums (based on the
owl:oneOf
restrictions mentioned above), I made a handful of other cleanup changes. Apologies in advance if this makes reviewing difficult.The cleanup changes included:
if
,for
, etc.) within curly braces. (More for safety and a little bit for readability){
that follows)this.
when I noticed a class variable is being used. (good practice, but also readability).size() == 0
or.size() !=0
with.isEmpty()
or! ... .isEmpty()
.I will make a future PR to try and make all of the formatting consistent throughout (but without any functional changes). These formatting updates were mostly localized to where I was already making other changes OR easy to identify/fix.