Configuration Block Specification
All SA configuration blocks are HTML <script>
elements with a specific structure.
Here's an example;
The script tag supports has 3 defined attributes;
type
= application/sa+json
type
= application/sa+json
Identifies the script MIME type as an SA configuration block.
SA6 will support Sygnal's HSON data format natively as well, with the application/sa+hson
type.
Type
Name
Handler
Here's an example;
Engineer's Technical Notes
We've designed SA's Configuration Blocks protocol with a number of primary considerations.
Standards compliance;
Conventional HTML
<script>
mechanics are usedScripts are never rendered as page content
The MIME type ensures that it is not confused with regular scripts
Conventional JSON standards are supported
Script efficiency;
SA library scripts can easily locate relevant configuration blocks
Explicit types can be found by matching the handler name; script[handler="handler-name" i]
And/or the handler categories;
script[handler="handler-name" i], script[handler^="handler-name." i]
Where possible these handler names are case-insensitive
Configuration blocks can also be identified by specific name
Convenience
Where possible, case-insensitive value matches
script[handler="handler-name" i]
Extensibility & future proofing;
e.g. a typical Basin Contact Us form
Data pulled in from session var
Overridden with data here
TransactionID created / set
Make these easier to find
Decisions
@context
@type
@version
? change @type to @handler
? is there value to context and type?
SEO?
Docs?
Make these easier to find
Named Config Blocks
Used when referenced from a :config
modifier on a base attribute.
name
added
Supported Data Formats
JSON
HSON ( coming soon )
Approach Notes
We're moving towards a precedent set by JSON-LD, as it's cleaner and more utilitarian.
About the MIME Type
In general, we'll stick with standard conventions;
The type of application/sa+json follows conventions like JSON-LD, which is `application
Legacy
application/
:The primary type (
application
) represents a general type of data. Itβs often used for data that doesn't fall under other primary types such astext
,image
,audio
, etc.application/
typically indicates that the content is not intended to be directly displayed to the user but rather used or processed by an application. For example,application/json
,application/xml
, andapplication/pdf
indicate that the content is primarily intended for programmatic use.
sa5+json
:The
+json
suffix tells the system that the content is in JSON format and should be handled as such. It helps parsers and applications recognize how to process the content.The
sa5
is a custom subtype, giving a specific indication about what the JSON content represents in the context of your system.
Last updated
Was this helpful?