diff --git a/.changeset/const-is-a-value.md b/.changeset/const-is-a-value.md deleted file mode 100644 index 973c185..0000000 --- a/.changeset/const-is-a-value.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'fiber': patch ---- - -Read `const` when building a body from a schema. - -OpenAPI 3.1 uses JSON Schema 2020-12, where a literal is written as `const` and a literal union as `anyOf: [{const: "once"}, {const: "always"}]`. That is what 3.1 generators emit where 3.0 would have written an `enum`. Fiber read `example`, `default` and `enum`, but not `const` — so it walked into the first branch, found nothing to go on, and printed the `string` placeholder for a field whose only legal values were named right there. Sending that body back got it rejected by the very document it came from. - -One real spec this was found against writes 543 `const`s and not a single `enum`, so the existing `enum` handling never fired once across 658 paths. A `const` is now taken as the value it names, in request skeletons and in form fields alike. diff --git a/CHANGELOG.md b/CHANGELOG.md index 7067b23..1c5b7c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # fiber +## 0.14.6 + +### Patch Changes + +- [#81](https://github.com/MathiasWP/fiber/pull/81) [`a7def54`](https://github.com/MathiasWP/fiber/commit/a7def5409481d34d62178de1de3f50303ae0fd81) Thanks [@MathiasWP](https://github.com/MathiasWP)! - Read `const` when building a body from a schema. + + OpenAPI 3.1 uses JSON Schema 2020-12, where a literal is written as `const` and a literal union as `anyOf: [{const: "once"}, {const: "always"}]`. That is what 3.1 generators emit where 3.0 would have written an `enum`. Fiber read `example`, `default` and `enum`, but not `const` — so it walked into the first branch, found nothing to go on, and printed the `string` placeholder for a field whose only legal values were named right there. Sending that body back got it rejected by the very document it came from. + + One real spec this was found against writes 543 `const`s and not a single `enum`, so the existing `enum` handling never fired once across 658 paths. A `const` is now taken as the value it names, in request skeletons and in form fields alike. + ## 0.14.5 ### Patch Changes diff --git a/package.json b/package.json index a720319..9f4d1ce 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fiber", "private": true, - "version": "0.14.5", + "version": "0.14.6", "type": "module", "packageManager": "pnpm@11.22.0", "engines": { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 6a2feca..78d35d9 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1285,7 +1285,7 @@ dependencies = [ [[package]] name = "fiber" -version = "0.14.5" +version = "0.14.6" dependencies = [ "base64 0.23.1", "dirs", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index e39cb44..d88a117 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fiber" -version = "0.14.5" +version = "0.14.6" description = "A local-first API client" authors = ["Mathias Picker"] license = "MIT" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a49d5c0..df67df8 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "Fiber", - "version": "0.14.5", + "version": "0.14.6", "identifier": "dev.fiber.app", "build": { "frontendDist": "../build",