Codex Documentation Manager
Components
JSON Schema

Generating fields

The JsonSchemaFields component can analyze a jsonschema file and build a field listing from it.

Nested field structures can be rendered and markdown syntax inside the description field will be rendered.

This component supports a subset of the jsonschema properties:

  • It will apply required flags to the field

  • It will add format information to the description

  • It will apply type definitions to the field

  • It will will generate nested fields with dot notation names

Contents of medical.json
{
  "description": "Schema for representing a health record",
  "type": "object",
  "required": ["patientName", "dateOfBirth", "bloodType"],
  "properties": {
    "patientName": {
      "description": "Patient's name",
      "type": "string"
    },
    "dateOfBirth": {
      "description": "Patient's date of birth",
      "type": "string",
      "format": "date"
    },
    "bloodType": {
      "description": "Patient's blood type",
      "type": "string"
    },
    "allergies": {
      "description": "Patient's **allergies**",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "conditions": {
      "description": "Patient's conditions",
      "type": "array",
      "items": {
        "type": "object",
        "description": "Description of the condition",
        "properties": {
          "name": {
            "description": "Description of the condition",
            "type": "string"
          },
          "diagnosisDate": {
            "description": "Date of diagnosis",
            "type": "string",
            "format": "date"
          }
        }
      }
    }
  }
}
Component usage
<JsonSchemaFields file="cookbook/medical.json"/>
allergies
required
Array(String)
bloodType
required
String
conditions
required
Array(Object)
conditions.name
required
String
dateOfBirth
required
String
patientName
required
String

Generating an example

An example block can also be generated automatically from a schema file.

<JsonSchemaExample file="cookbook/medical.json"/>
{
  "allergies": [
    "Value"
  ],
  "bloodType": "Value",
  "conditions": [
    {
      "diagnosisDate": "Value",
      "name": "Value"
    }
  ],
  "dateOfBirth": "Value",
  "patientName": "Value"
}
Generated by Codex