Last active
January 8, 2026 11:32
-
-
Save lornajane/2122f84a0829b99cfc60ca4f9832cf5a to your computer and use it in GitHub Desktop.
rfc9727 validation schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "http://json-schema.org/draft-07/schema#", | |
| "$id": "https://example.com/schemas/rfc9727-api-catalog.json", | |
| "title": "RFC 9727 API Catalog Linkset", | |
| "description": "JSON Schema for validating RFC 9727 compliant API catalog linkset documents", | |
| "type": "object", | |
| "required": ["linkset"], | |
| "properties": { | |
| "linkset": { | |
| "type": "array", | |
| "minItems": 1, | |
| "items": { | |
| "$ref": "#/definitions/linkContextObject" | |
| } | |
| } | |
| }, | |
| "additionalProperties": false, | |
| "definitions": { | |
| "linkContextObject": { | |
| "type": "object", | |
| "required": ["anchor"], | |
| "properties": { | |
| "anchor": { | |
| "type": "string", | |
| "pattern": "^https?://", | |
| "description": "The link context URI" | |
| }, | |
| "profile": { | |
| "type": "array", | |
| "description": "Profile information for the linkset", | |
| "items": { | |
| "type": "object", | |
| "required": ["href"], | |
| "properties": { | |
| "href": { | |
| "type": "string", | |
| "pattern": ".*rfc9727.*", | |
| "description": "Must reference RFC 9727" | |
| }, | |
| "type": { | |
| "type": "string", | |
| "enum": ["application/linkset+json"], | |
| "description": "Media type" | |
| } | |
| } | |
| } | |
| }, | |
| "status": { | |
| "type": "array", | |
| "description": "Links to status information about the API", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "service-desc": { | |
| "type": "array", | |
| "description": "Links to machine-readable API descriptions (OpenAPI, AsyncAPI, etc.)", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "service-doc": { | |
| "type": "array", | |
| "description": "Links to human-readable API documentation", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "service-meta": { | |
| "type": "array", | |
| "description": "Links to metadata about the API", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "collection": { | |
| "type": "array", | |
| "description": "Links to API collections (e.g., Postman collections)", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "describedby": { | |
| "type": "array", | |
| "description": "Links to resources that describe this API", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "license": { | |
| "type": "array", | |
| "description": "Links to license information", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "terms-of-service": { | |
| "type": "array", | |
| "description": "Links to terms of service", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "help": { | |
| "type": "array", | |
| "description": "Links to help resources", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "contact": { | |
| "type": "array", | |
| "description": "Contact information", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "example": { | |
| "type": "array", | |
| "description": "Links to examples or tutorials", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| }, | |
| "sandbox": { | |
| "type": "array", | |
| "description": "Links to sandbox/testing environments", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| } | |
| }, | |
| "patternProperties": { | |
| "^(?!anchor$|profile$|status$|service-desc$|service-doc$|service-meta$|collection$|describedby$|license$|terms-of-service$|help$|contact$|example$|sandbox$)[a-z][a-z0-9-]*$": { | |
| "type": "array", | |
| "description": "Custom relation types (must be lowercase with hyphens)", | |
| "items": { | |
| "$ref": "#/definitions/linkObject" | |
| } | |
| } | |
| }, | |
| "not": { | |
| "required": ["item"], | |
| "properties": { | |
| "item": {} | |
| } | |
| }, | |
| "additionalProperties": false | |
| }, | |
| "linkObject": { | |
| "type": "object", | |
| "required": ["href"], | |
| "properties": { | |
| "href": { | |
| "type": "string", | |
| "pattern": "^https?://", | |
| "description": "The link target URI" | |
| }, | |
| "type": { | |
| "type": "string", | |
| "description": "Media type of the linked resource", | |
| "examples": [ | |
| "application/json", | |
| "application/yaml", | |
| "application/pdf", | |
| "application/zip", | |
| "text/html" | |
| ] | |
| }, | |
| "title": { | |
| "type": "string", | |
| "description": "Human-readable title for the link" | |
| }, | |
| "profile": { | |
| "type": "string", | |
| "pattern": "^https?://", | |
| "description": "Profile URI for the linked resource", | |
| "examples": [ | |
| "https://spec.openapis.org/oas/v3.0", | |
| "https://spec.openapis.org/oas/v3.1" | |
| ] | |
| }, | |
| "hreflang": { | |
| "type": "string", | |
| "pattern": "^[a-z]{2}(-[A-Z]{2})?$", | |
| "description": "Language of the linked resource (e.g., 'en', 'en-US')" | |
| }, | |
| "context": { | |
| "type": "string", | |
| "pattern": "^https?://", | |
| "description": "Context URI for custom relation types" | |
| } | |
| }, | |
| "not": { | |
| "required": ["rel"] | |
| }, | |
| "additionalProperties": false | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment