public
Last active

Possible Formats for .yes document using invoice.yml example.

  • Download Gist
invoice-A.yes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
---
/:
tag: <tag:clarkevans.com,2002:invoice>
invoice: &mandatoryint
type: int
required: true
date:
type: date
required: true
bill-to: &billing-schema-alias
type: map
required: true
bill-to/given: &amms # Short for "All Mandatory Strings Schema"
type: str
required: true
bill-to/family: *amms
bill-to/address:
type: map
required: true
bill-to/address/lines: *amms
bill-to/address/city: *amms # Or suburb.
bill-to/address/state: &aoss # Short for "All Optional Strings Schema"
type: string
required: false # Not every country has states or provinces.
bill-to/address/country: &aoss # Unnecessary if posting in the same country.
bill-to/address/postal: &aoss # Some countries don't use postcodes.
ship-to: *billing-schema-alias # Yay for anchors and aliases!
tax: &currency # Should indicate two decimal places - no more, no less.
type: float
required: true
total: *currency
comments: *amms
product:
type: seqorsing: # See below
required: true
product/sku: *amms
product/quantity: *mandatoryint
product/description: *amms
product/price: *currency
...
invoice-B.yes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
---
/:
tag: <tag:clarkevans.com,2002:invoice>
value:
invoice: &mandatoryint
type: int
required: true #Shouldn't we use booleans like true and false?
date:
type: datetime #Indicate somehow that dates are required, buttimes are not?
required: true
bill-to: &billing-schema-alias
type: map
required: true
value: # We could refer to this by Ypaths, but it feels more natural to embed in it the parent structure schema
given: &amms # Short for "All Mandatory Strings Schema"
type: str
required: true
family: *amms
address:
type: map
required: true
value:
lines: *amms
city: *amms # Or suburb.
state: &aoss # Short for "All Optional Strings Schema"
type: string
required: false # Not every country has states or provinces.
country: &aoss # Unnecessary if posting in the same country.
postal: &aoss # Some countries don't use postcodes.
ship-to: *billing-schema-alias # Yay for anchors and aliases!
tax: &currency # Should indicate two decimal places - no more, no less.
type: float
required: true
total: *currency
comments: *amms
product:
type: seqorsing: # See below
required: true
value:
sku: *amms
quantity: *mandatoryint
description: *amms
price: *currency
...
invoice-C.yes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
---
/:
@tag: <tag:clarkevans.com,2002:invoice>
invoice: &mandatoryint
@type: int
@required: true #Shouldn't we use booleans like true and false?
date:
@type: datetime #Indicate somehow that dates are required, buttimes are not?
@required: true
bill-to: &billing-schema-alias
@type: map
@required: true
given: &amms # Short for "All Mandatory Strings Schema"
@type: str
@required: true
family: *amms
address:
@type: map
@required: true
lines: *amms
city: *amms # Or suburb.
state: &aoss # Short for "All Optional Strings Schema"
@type: string
@required: false # Not every country has states or provinces.
country: &aoss # Unnecessary if posting in the same country.
postal: &aoss # Some countries don't use postcodes.
ship-to: *billing-schema-alias # Yay for anchors and aliases!
tax: &currency # Should indicate two decimal places - no more, no less.
@type: float
@required: true
total: *currency
comments: *amms
product:
@type: seqorsing: # See below
@required: true
sku: *amms
quantity: *mandatoryint
description: *amms
price: *currency
...

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.