Skip to content

Instantly share code, notes, and snippets.

@nkabrown
Last active February 25, 2026 03:34
Show Gist options
  • Select an option

  • Save nkabrown/edd5c01c6573410afacf2aad993d7587 to your computer and use it in GitHub Desktop.

Select an option

Save nkabrown/edd5c01c6573410afacf2aad993d7587 to your computer and use it in GitHub Desktop.
Schema-on-Read

Schema-on-Read

How can frontend applications best work with Open API specifications?

JSON Schema

https://json-schema.org/

JSON Schema is a declarative language for defining structures and constraints for JSON data. JSON Schema is a media type (application/schema+json) for defining the structure of JSON data.

A JSON Schema is a JSON document with a special media type (application/schema+json) used to describe an instance that is applied to an JSON document "instance" of media type (application/json).

OpenAPI

JSON Schema for Open API https://spec.openapis.org/oas/3.0/schema/2024-10-18.html

Appendix

Media Types

A media type (MIME type) indicates the nature and format of a document, file, or assortment of bytes.

Definition and standard: https://datatracker.ietf.org/doc/html/rfc6838

Up-to-date and complete list at IANA https://www.iana.org/assignments/media-types/media-types.xhtml

Structure

type/subtype;parameter=value

Where they're used:

  • HTTP Content-Type headers (tells browsers how to handle responses)
  • HTML and <script> tags (type attribute)
  • File uploads (indicates what kind of file is being sent)
  • Email attachments (originally designed for email, hence "Mail Extensions")

JSON

JSON stands for JavaScript Object Notation and it is a simple data interchange format.

Standard https://www.rfc-editor.org/rfc/pdfrfc/rfc8259.txt.pdf

JSON is built on the following data structures:

object

{ "key1": "value1", "key2": "value2" }

arrays

[ "first", "second", "third" ]

number

42
3.1415926

string

"This is a string"

boolean

true
false

null

null

All types of structured data can be represented with these simple data types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment