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
1 change: 1 addition & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
parser
ir
cli-v2
cli-generator
requireScope: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ When creating pull requests in this repository:

**Allowed types**: `fix`, `feat`, `revert`, `break`, `chore`

**Allowed scopes**: `docs`, `changelog`, `internal`, `cli`, `typescript`, `python`, `java`, `csharp`, `go`, `php`, `ruby`, `seed`, `ci`, `lint`, `fastapi`, `spring`, `openapi`, `deps`, `deps-dev`, `pydantic`, `ai-search`, `swift`, `rust`
**Allowed scopes**: `docs`, `changelog`, `internal`, `cli`, `typescript`, `python`, `java`, `csharp`, `go`, `php`, `ruby`, `seed`, `ci`, `lint`, `openapi`, `deps`, `deps-dev`, `pydantic`, `ai-search`, `swift`, `rust`, `generator-cli`, `parser`, `ir`, `cli-v2`, `cli-generator`

**Examples**: `chore(docs): update guidelines`, `feat(python): add new feature`, `fix(cli): resolve config loading bug`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public static function fromJson(string $json): static
throw new JsonException("Unexpected non-array decoded type: " . gettype($decodedJson));
}
/** @var array<string, mixed> $decodedJson */
return self::jsonDeserialize($decodedJson);
// static:: (not self::) so subclasses' typed jsonDeserialize overrides are dispatched via late static binding.
return static::jsonDeserialize($decodedJson);
}

/**
Expand Down
56 changes: 0 additions & 56 deletions generators/php/model/src/union/UnionGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ export class UnionGenerator extends FileGenerator<PhpFile, ModelCustomConfigSche

clazz.addMethod(this.jsonSerializeMethod());

clazz.addMethod(this.fromJsonMethod());

clazz.addMethod(this.jsonDeserializeMethod());

return new PhpFile({
Expand Down Expand Up @@ -947,60 +945,6 @@ export class UnionGenerator extends FileGenerator<PhpFile, ModelCustomConfigSche
});
}

private fromJsonMethod(): php.Method {
return php.method({
name: "fromJson",
access: "public",
parameters: [
php.parameter({
name: "json",
type: php.Type.string()
})
],
return_: STATIC,
body: php.codeblock((writer) => {
writer.write("$decodedJson = ");
writer.writeNodeStatement(
php.invokeMethod({
method: "decode",
arguments_: [php.codeblock("$json")],
static_: true,
on: this.context.getJsonDecoderClassReference()
})
);

const negation = php.codeblock((_writer) => {
_writer.write("!");
_writer.writeNode(
php.invokeMethod({
method: "is_array",
arguments_: [php.codeblock("$decodedJson")],
static_: true
})
);
});
writer.controlFlow("if", negation);
writer.writeNodeStatement(
php.throwException({
classReference: this.context.getExceptionClassReference(),
arguments_: [php.codeblock('"Unexpected non-array decoded type: " . gettype($decodedJson)')]
})
);
writer.endControlFlow();
writer.write("return ");
writer.writeNodeStatement(
php.invokeMethod({
method: "jsonDeserialize",
arguments_: [php.codeblock("$decodedJson")],
static_: true,
on: php.codeblock("self")
})
);
}),
static_: true
});
}

private jsonDeserializeMethod(): php.Method {
const discriminantPropertyName = this.context.getPropertyName(this.unionTypeDeclaration.discriminant);
const discriminantVariableName = this.context.getVariableName(this.unionTypeDeclaration.discriminant);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- summary: |
Generated discriminated unions no longer emit a `fromJson()` override. The base
`JsonSerializableType::fromJson` now uses late static binding (`static::jsonDeserialize`)
so subclasses' typed `jsonDeserialize` overrides dispatch correctly. This eliminates ~50
lines of duplicated code per union and resolves a PHPStan strict failure where the union
override's `$decodedJson` was narrowed to `array<array-key, mixed>` instead of
`array<string, mixed>`.
type: fix
12 changes: 12 additions & 0 deletions generators/php/sdk/versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
- version: 2.10.4
changelogEntry:
- summary: |
Generated discriminated unions no longer emit a `fromJson()` override. The base
`JsonSerializableType::fromJson` now uses late static binding (`static::jsonDeserialize`)
so subclasses' typed `jsonDeserialize` overrides dispatch correctly. This eliminates ~50
lines of duplicated code per union and resolves a PHPStan strict failure where the union
override's `$decodedJson` was narrowed to `array<array-key, mixed>` instead of
`array<string, mixed>`.
type: fix
createdAt: "2026-05-22"
irVersion: 66
- version: 2.10.3
changelogEntry:
- summary: |
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/cli-v2/src/sdk/config/converter/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export const DOCKER_IMAGE_TO_GENERATOR_ID: Record<string, string> = {
"fernapi/fern-go-model": "go-model",
"fernapi/fern-csharp-sdk": "csharp-sdk",
"fernapi/fern-csharp-model": "csharp-model",
"fernapi/fern-ruby-sdk": "ruby-sdk",
"fernapi/fern-ruby-sdk": "ruby-sdk-v2",
"fernapi/fern-ruby-sdk-v2": "ruby-sdk-v2",
"fernapi/fern-php-sdk": "php-sdk",
"fernapi/fern-php-model": "php-model",
"fernapi/fern-rust-sdk": "rust-sdk",
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/cli/changes/5.37.8/fix-ruby-sdk-fdr-lookup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- summary: |
Fix FDR generator version lookup for Ruby SDK to use the correct registry ID
(`ruby-sdk-v2`) instead of the stale legacy ID (`ruby-sdk`). This ensures
`fern generator upgrade` and IR version resolution return the actual latest
Ruby SDK generator version.
type: fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# yaml-language-server: $schema=../../../../../fern-changes-yml.schema.json

- summary: |
Add `cli-generator` to the allowed PR title scopes enforced by the lint-pr-title workflow.
type: chore
17 changes: 17 additions & 0 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
- version: 5.37.9
changelogEntry:
- summary: |
Add `cli-generator` to the allowed PR title scopes enforced by the lint-pr-title workflow.
type: chore
createdAt: "2026-05-22"
irVersion: 66
- version: 5.37.8
changelogEntry:
- summary: |
Fix FDR generator version lookup for Ruby SDK to use the correct registry ID
(`ruby-sdk-v2`) instead of the stale legacy ID (`ruby-sdk`). This ensures
`fern generator upgrade` and IR version resolution return the actual latest
Ruby SDK generator version.
type: fix
createdAt: "2026-05-22"
irVersion: 66
- version: 5.37.7
changelogEntry:
- summary: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ function getGeneratorMetadataFromName(generatorName: string, context?: TaskConte
return "csharp-model";
// Ruby
case "fern-ruby-sdk":
return "ruby-sdk";
case "fern-ruby-sdk-v2":
return "ruby-sdk-v2";
// Misc.
case "fern-postman":
return "postman";
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion seed/php-sdk/allof/src/Core/Json/JsonSerializableType.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion seed/php-sdk/any-auth/src/Core/Json/JsonSerializableType.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading