# Avro parsing canonical form

`avro-parsing-canonical-form` · version 1.0.0 · Structured formats · free, no key needed

Produce the Avro 1.12.0 parsing canonical form for a bounded schema.

**Use when you need to: avro parsing canonical form · canonicalize avro schema · normalize avro schema.**

## Decide before calling

Read the [versioned contract](/v1/tools/avro-parsing-canonical-form/versions/1.0.0) and the supported scope below. Reuse `avro-parsing-canonical-form@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `avro-parsing-canonical-form@1.0.0` for avro parsing canonical form. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- avro parsing canonical form
- canonicalize avro schema
- normalize avro schema
- strip avro schema metadata
- resolve avro schema full names
- produce stable avro schema text

## Not supported

- validate data against a schema
- resolve schemas from files or registries
- compute Rabin fingerprints other than CRC-64-AVRO

## Behavior

- Implements Apache Avro Specification 1.12.0 Parsing Canonical Form for Schemas.
- Supports primitives, records, enums, fixed, arrays, maps, unions, and backward references to already-declared names.
- Applies PRIMITIVES, FULLNAMES, STRIP, ORDER, STRINGS, and INTEGERS; aliases, docs, defaults and logical-type metadata are stripped.
- Rejects forward or unresolved references and all malformed, cyclic, non-JSON, duplicate, or over-limit inputs.

## Input

- `schema` (any JSON value, required)

## Output

- `canonical_form` (string, required): max length 32768
- `standard_version` (constant "Apache Avro Specification 1.12.0", required)

## Limits

- max input bytes: 16384
- max schema nodes: 512
- max depth: 32
- max fields: 128
- max output bytes: 32768

## Example

Request input:

```json
{
  "schema": {
    "type": "record",
    "name": "R",
    "doc": "x",
    "fields": [
      {
        "name": "a",
        "type": "long",
        "default": 0
      }
    ]
  }
}
```

Response:

```json
{
  "result": {
    "canonical_form": "{\"name\":\"R\",\"type\":\"record\",\"fields\":[{\"name\":\"a\",\"type\":\"long\"}]}",
    "standard_version": "Apache Avro Specification 1.12.0"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "avro-parsing-canonical-form",
  "version": "1.0.0",
  "input": {
    "schema": {
      "type": "record",
      "name": "R",
      "doc": "x",
      "fields": [
        {
          "name": "a",
          "type": "long",
          "default": 0
        }
      ]
    }
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/avro-parsing-canonical-form/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"schema":{"type":"record","name":"R","doc":"x","fields":[{"name":"a","type":"long","default":0}]}}'
```

The machine-readable contract is at [/v1/tools/avro-parsing-canonical-form/versions/1.0.0](/v1/tools/avro-parsing-canonical-form/versions/1.0.0).

### CLI

```sh
node cli.mjs run avro-parsing-canonical-form 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Avro schema fingerprint](/tools/avro-schema-fingerprint): Compute the CRC-64-AVRO fingerprint of an Avro 1.12.0 parsing canonical form.
- [Avro schema equivalence check](/tools/avro-schema-equivalence-check): Decide whether two Avro schemas have identical Avro 1.12.0 parsing canonical forms.
- [XML exc c14n subtree](/tools/xml-exc-c14n-subtree): Exclusive XML Canonicalization 1.0 of one selected element and its descendants.
- [INI win format](/tools/ini-win-format): Format sections and keys into stable Windows initialization-file text.
- [XML exc c14n canonicalize](/tools/xml-exc-c14n-canonicalize): Exclusive XML Canonicalization 1.0 of a whole document, with an optional inclusive prefix list.
- [Asn1 der encode tree](/tools/asn1-der-encode-tree): Encode a schema-free ASN.1 node list as one canonical DER value.
