# `Exdantic.JsonSchema`
[🔗](https://github.com/nshkrdotcom/exdantic/blob/v0.1.0/lib/exdantic/json_schema.ex#L1)

A module for converting Exdantic schema definitions into JSON Schema format.
Handles field types, metadata, references, and definitions generation.

# `json_schema`

```elixir
@type json_schema() :: %{required(String.t()) =&gt; term()}
```

# `extract_computed_field_info`

```elixir
@spec extract_computed_field_info(json_schema()) :: [map()]
```

Extracts computed field information from a JSON schema.

This function can parse a JSON schema generated by Exdantic and extract
information about computed fields from the x-computed-field metadata.

## Parameters
  * `json_schema` - The JSON schema to analyze

## Returns
  * List of computed field information maps

## Examples

    iex> schema = Exdantic.JsonSchema.from_schema(UserSchema)
    iex> Exdantic.JsonSchema.extract_computed_field_info(schema)
    [
      %{
        name: "full_name",
        type: %{"type" => "string"},
        function: "UserSchema.generate_full_name/1",
        readonly: true
      }
    ]

# `from_schema`

```elixir
@spec from_schema(module()) :: json_schema()
```

Converts an Exdantic schema module to a JSON Schema representation.

## Parameters
  * `schema` - The schema module to convert

## Returns
  * A map representing the JSON Schema

## Examples

    iex> defmodule TestSchema do
    ...>   use Exdantic
    ...>   schema do
    ...>     field :name, :string
    ...>   end
    ...> end
    iex> Exdantic.JsonSchema.from_schema(TestSchema)
    %{"type" => "object", "properties" => %{"name" => %{"type" => "string"}}}

# `has_computed_fields?`

```elixir
@spec has_computed_fields?(json_schema()) :: boolean()
```

Checks if a JSON schema contains computed fields.

## Parameters
  * `json_schema` - The JSON schema to check

## Returns
  * `true` if the schema contains computed fields, `false` otherwise

## Examples

    iex> schema = Exdantic.JsonSchema.from_schema(UserSchema)
    iex> Exdantic.JsonSchema.has_computed_fields?(schema)
    true

# `remove_computed_fields`

```elixir
@spec remove_computed_fields(json_schema()) :: json_schema()
```

Removes computed fields from a JSON schema.

This can be useful when you want to generate a schema for input validation
that excludes computed fields, since computed fields are output-only.

## Parameters
  * `json_schema` - The JSON schema to process

## Returns
  * JSON schema with computed fields removed

## Examples

    iex> schema = Exdantic.JsonSchema.from_schema(UserSchema)
    iex> input_schema = Exdantic.JsonSchema.remove_computed_fields(schema)
    # input_schema will not contain computed fields

---

*Consult [api-reference.md](api-reference.md) for complete listing*
