Skip to content

Schema.Never properties cannot round-trip through JSON Schema #8137

Description

@Chasewhip8

What version of Effect is running?

4.0.0-rc.112

What steps can reproduce the bug?

import { Schema, SchemaRepresentation } from "effect"

const document = Schema.toJsonSchemaDocument(
  Schema.Struct({ value: Schema.optionalKey(Schema.Never) })
)

SchemaRepresentation.fromJsonSchemaDocument(document)

What is the expected behavior?

Import succeeds. The imported schema accepts {} and rejects any supplied value.

What do you see instead?

Unsupported JSON Schema keyword "not"
  at ["schema"]["properties"]["value"]["not"]

Additional information

The exporter emits { "not": {} }, but the importer rejects it. Replacing that property schema with the equivalent false works.

This also blocks @effect/openapi-generator@4.0.0-rc.112 from reading Effect-generated OpenAPI specs. Related: #7410.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions