Namespaces

Contents

An application defines the namespace its schemas live in, preventing collisions between independent providers.

Identifier

Every schema is identified as <namespace>:<name> (e.g. com.example.myapp:article). The namespace groups the schemas that are shipped together, and prevents collisions between independent providers that happen to use the same schema name.

A namespace is a dot-separated identifier, and it is the application name: an application named com.example.myapp defines the com.example.myapp namespace, and the schemas it ships live there. The developer does not declare the namespace explicitly. Reverse-DNS (com.<org>.<app>) is a common convention but not required — acme.editorial or myschemas work just as well.

Each dot-separated segment may contain letters, digits, and underscores. Dashes are not allowed, since dots are converted to dashes when a namespace is used in a property name. The identifier is limited to 63 characters in total. Lowercase is the convention.

Reserved namespaces

Namespaces are not limited to schemas — the same identifier names the application in every other context as well. Four namespaces are reserved by the platform for built-in functionality, and cannot be used as an application name:

base

Structural content types (base:folder, base:shortcut, base:unstructured).

portal

Sites and pages types (portal:site, portal:page-template, portal:fragment, portal:template-folder).

media

Media types (media:image, media:document, etc.).

system

Platform built-ins that are not schemas, such as the built-in macros (system:disable, system:embed) and validation error codes.

Beyond the four reserved names, built-in platform APIs occupy namespaces of their own — server for the management APIs (e.g. server:app) and admin for the admin APIs (e.g. admin:status, admin:event). These are not rejected as application names, but an application using them would collide with the built-in APIs.

Encoding in stored content and APIs

The literal <namespace>:<name> identifier is preserved in some contexts and re-encoded in others, depending on what characters are legal in the surrounding format.

Values preserved

  • For values, such as in the type field on a content item — e.g. "type": "com.example.myapp:article". Use this exact form for content queries against type (Query DSL, queryDsl in Guillotine). See Content.

Re-encoded

  • Property names (where namespaces are used in property names): dots become dashes — com.examplecom-example. A city field on com.example:address is stored at x.com-example.address.city. See Mixins for more examples.

  • Guillotine GraphQL types: dots and dashes become underscores — com.example.myapp:news-articlecom_example_myapp_news_article. See Content Types for the full table.


Contents

Contents