# SchemaFields

The required, optional, and per-query schema fields derived from Path AST nodes.

## Signatures

```ts
export type SchemaFields = {
    readonly requiredFields: ReadonlyArray<SchemaField>;
    readonly optionalFields: ReadonlyArray<OptionalSchemaField>;
};
```

## Why

Path and query schemas can be projected separately from one analysis pass.

## Ownership and lifetime

`SchemaFields` is a readonly structural contract. The concrete arrays, AST nodes, names, and Schemas remain owned by the caller that constructs them.

## Property: optionalFields

Optional output keys and their Codecs.

## Property: optionalFields: Why

Optional route segments and query values must remain optional in the derived record Schema.

## Property: optionalFields: Ownership and lifetime

The containing analysis result owns this readonly array; Schema values are shared references and
acquire services only when decoding or encoding runs.

## Property: requiredFields

Required output keys and their Codecs.

## Property: requiredFields: Why

Required and optional fields are passed separately to Effect Schema record construction.

## Property: requiredFields: Ownership and lifetime

The containing analysis result owns this readonly array; Schema values are shared references and
acquire services only when decoding or encoding runs.
