Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/bright-dolls-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@effect/platform": patch
"effect": patch
---

Escape JSON Schema $id for empty struct
4 changes: 2 additions & 2 deletions packages/effect/src/JSONSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface JsonSchema7object extends JsonSchemaAnnotations {
* @since 3.10.0
*/
export interface JsonSchema7empty extends JsonSchemaAnnotations {
$id: "/schemas/{}"
$id: "/schemas/%7B%7D"
anyOf: [
{ type: "object" },
{ type: "array" }
Expand Down Expand Up @@ -348,7 +348,7 @@ const constAnyObject: JsonSchema7 = {
}

const constEmpty: JsonSchema7 = {
"$id": "/schemas/{}",
"$id": "/schemas/%7B%7D",
"anyOf": [
{ "type": "object" },
{ "type": "array" }
Expand Down
4 changes: 2 additions & 2 deletions packages/effect/test/Schema/JSONSchema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ describe("fromAST", () => {
it("NullOr(Struct({}))", () => {
const schema = Schema.NullOr(Schema.Struct({}))
expectJSONSchemaOpenApi31(schema, {
"$id": "/schemas/{}",
"$id": "/schemas/%7B%7D",
"anyOf": [
{ "type": "object" },
{ "type": "array" }
Expand Down Expand Up @@ -834,7 +834,7 @@ details: Cannot encode Symbol(effect/Schema/test/a) key to JSON Schema`
it("empty struct: Schema.Struct({})", () => {
const schema = Schema.Struct({})
const jsonSchema: Root = {
"$id": "/schemas/{}",
"$id": "/schemas/%7B%7D",
"anyOf": [{
"type": "object"
}, {
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/OpenApiJsonSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface AnyObject extends Annotations {
* @since 0.71.0
*/
export interface Empty extends Annotations {
$id: "/schemas/{}"
$id: "/schemas/%7B%7D"
anyOf: [
{ type: "object" },
{ type: "array" }
Expand Down