spatie / schema-org

A fluent builder Schema.org types and ld+json generator

Home Page:https://freek.dev/2016/12/package-fluently-generate-schema-org-markup/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add public constant to make implementation easier

JohJohan opened this issue · comments

We could add public constants that define string values that a developer can use during implementation. example:

When adding a JobPosting (https://schema.org/JobPosting) you can add the property employmentType( https://schema.org/employmentType) schema already defines a set of options you can pass:

Type of employment (e.g. full-time, part-time, contract, temporary, seasonal, internship).

We could define these as constant the help the developer to implement and to prevent spelling mistakes in these values. There are probably more examples to add consts for but i found this when i was reading implementation of JobPosting on Google documentation: https://developers.google.com/search/docs/data-types/job-posting#job-posting-definition where they also suggest these values (only then upper case idk why)

Let me know what you think if it is a good idea i can look into create a list of these and then implement them let me know :)

Hey,
these values aren't part of the schema.org RDFa and also not a real enum. They are only a common set of values several vendors agreed to.
Parsing schema.org values is a super flexible thing as nearly nothing is really fixed.
And as they aren't part of the RDFa we can't/won't implement them.
In case that changes somewhen the generator can be extended.

PS: values that are real enums are already available as const.
https://github.com/spatie/schema-org/search?q=const

Okay cool that makes sense. I will close this issue