Skip to content

Commit 853518f

Browse files
jsklanclaudedevin-ai-integration[bot]
authored
fix(cli,csharp,go,java,python,ruby,rust,typescript): fix local vs remote generation parity (#11413)
* add test remote local script * Update script to use seed:local * build generator in test script * update test file * make build flag optional * Initial fix attempts * Fix java x-fern-sdk-name to match remote gen * Update versions.yml files * fix(java,cli): simplify local vs remote generation parity fixes - Add fallback SDK name generation in Java generator when no explicit maven config - Fix self-hosted GitHub URI format in CLI (owner/repo -> https://github.com/owner/repo) - Revert TypeScript constructNpmPackage to preserve npm shorthand format - Remove complex fallback registry config logic from getGeneratorConfig.ts The Java generator now generates a default maven coordinate (com.<org>.fern:<api>-sdk) matching Fiddle's RegistryConfigFactory behavior when neither generatorConfig.publish nor ir.publishConfig provides one. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix(cli,seed): improve remote vs local generation parity - Add shouldGeneratePublishWorkflow flag for npm publish info in local generation to match Fiddle's behavior (fixes ts-sdk CI publish job discrepancy) - Add token: "OIDC" to ts-sdk test config to enable publish workflow generation - Update JAVA_SDK_MAVEN_COORDINATE to match Fiddle's format (com.<org>.fern:<api>-sdk) - Remove duplicate getRepoUrlFromUrl call in AbstractGeneratorCli.ts that was causing URL mangling for self-hosted GitHub configurations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * relock * fix lock * fix(docker): pin generator-cli to 0.5.0 instead of @latest Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 1c68092 commit 853518f

File tree

28 files changed

+232
-37
lines changed

28 files changed

+232
-37
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,6 @@ seed/**/*.egg-info/
106106
# Seed remote-local test outputs, except for seed.yml files
107107
seed-remote-local/*
108108
!seed-remote-local/**/seed.yml
109+
110+
# Test logs from test-remote-local.sh
111+
test-remote-local-logs-*/

generators/csharp/sdk/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
1818
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
1919

2020
RUN dotnet tool install -g csharpier --version "1.2.1"
21-
RUN npm install -f -g @fern-api/generator-cli@0.2.0
21+
RUN npm install -f -g @fern-api/generator-cli@0.5.0
2222

2323
COPY generators/csharp/sdk/features.yml /assets/features.yml
2424
COPY generators/csharp/sdk/dist /dist

generators/csharp/sdk/versions.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
2+
- version: 2.12.2
3+
changelogEntry:
4+
- summary: Update Dockerfile CVE patches to work with newer generator-cli package structures.
5+
type: chore
6+
createdAt: "2026-01-05"
7+
irVersion: 62
8+
29
- version: 2.12.1
310
changelogEntry:
411
- summary: |

generators/go-v2/base/src/cli/AbstractGoGeneratorCli.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ export abstract class AbstractGoGeneratorCli<
2222
}
2323

2424
protected async generateMetadata(context: GoGeneratorContext): Promise<void> {
25+
// Go convention requires version strings to have a "v" prefix
26+
let sdkVersion = context.version;
27+
if (sdkVersion != null && sdkVersion !== "" && !sdkVersion.startsWith("v")) {
28+
sdkVersion = "v" + sdkVersion;
29+
}
2530
const metadata = {
2631
...context.ir.generationMetadata,
27-
sdkVersion: context.version
32+
sdkVersion
2833
};
2934
const content = JSON.stringify(metadata, null, 2);
3035
context.project.addRawFiles(

generators/go/fiber/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ RUN CGO_ENABLED=0 go build -ldflags "-s -w" -trimpath -buildvcs=false -o /fern-g
3737

3838
RUN test -f /bin/go-v2 || echo "go-v2 CLI not found or not executable"
3939

40-
RUN npm install -f -g @fern-api/generator-cli@0.2.0
40+
RUN npm install -f -g @fern-api/generator-cli@0.5.0
4141

4242
ENTRYPOINT ["/fern-go-fiber"]

generators/go/fiber/versions.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
2+
- version: 0.23.10
3+
changelogEntry:
4+
- summary: Update Dockerfile CVE patches to work with newer generator-cli package structures.
5+
type: chore
6+
createdAt: "2026-01-05"
7+
irVersion: 60
8+
29
- version: 0.23.9
310
changelogEntry:
411
- summary: |

generators/go/sdk/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ RUN CGO_ENABLED=0 go build -ldflags "-s -w" -trimpath -buildvcs=false -o /fern-g
3737

3838
RUN test -f /bin/go-v2 || echo "go-v2 CLI not found or not executable"
3939

40-
RUN npm install -f -g @fern-api/generator-cli@0.2.0
40+
RUN npm install -f -g @fern-api/generator-cli@0.5.0
4141

4242
ENTRYPOINT ["/fern-go-sdk"]

generators/go/sdk/versions.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
22

3+
- version: 1.22.1
4+
changelogEntry:
5+
- summary: |
6+
Add 'v' prefix to sdkVersion in metadata.json to follow Go module versioning conventions.
7+
type: fix
8+
createdAt: "2026-01-05"
9+
irVersion: 60
10+
311
- version: 1.22.0
412
changelogEntry:
513
- summary: |

generators/java/sdk/Dockerfile

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,29 @@ RUN git config --global user.email "115122769+fern-api[bot]@users.noreply.github
8787

8888
RUN test -f /bin/java-v2 || echo "java-v2 CLI not found or not executable"
8989

90-
RUN npm install -f -g @fern-api/generator-cli@0.2.0
90+
RUN npm install -f -g @fern-api/generator-cli@0.5.0
9191

9292
# Patch @octokit/request to fix CVE-2025-25290 (ReDoS vulnerability)
9393
# Use npm pack + tar to replace the package without running npm install (which fails due to workspace: protocol)
9494
# Also install fast-content-type-parse which is a new dependency in @octokit/[email protected]
95-
RUN cd /usr/local/lib/node_modules/@fern-api/generator-cli/node_modules/@octokit && \
96-
rm -rf request && \
97-
npm pack @octokit/[email protected] && \
98-
tar -xzf octokit-request-10.0.7.tgz && \
99-
mv package request && \
100-
rm octokit-request-10.0.7.tgz && \
101-
cd /usr/local/lib/node_modules/@fern-api/generator-cli/node_modules && \
102-
npm pack [email protected] && \
103-
tar -xzf fast-content-type-parse-2.0.1.tgz && \
104-
mv package fast-content-type-parse && \
105-
rm fast-content-type-parse-2.0.1.tgz
95+
# Note: Skip patching if @octokit directory doesn't exist (may be different in newer versions)
96+
RUN OCTOKIT_DIR="/usr/local/lib/node_modules/@fern-api/generator-cli/node_modules/@octokit" && \
97+
if [ -d "$OCTOKIT_DIR" ]; then \
98+
cd "$OCTOKIT_DIR" && \
99+
rm -rf request && \
100+
npm pack @octokit/[email protected] && \
101+
tar -xzf octokit-request-10.0.7.tgz && \
102+
mv package request && \
103+
rm octokit-request-10.0.7.tgz && \
104+
cd /usr/local/lib/node_modules/@fern-api/generator-cli/node_modules && \
105+
if [ ! -d "fast-content-type-parse" ]; then \
106+
npm pack [email protected] && \
107+
tar -xzf fast-content-type-parse-2.0.1.tgz && \
108+
mv package fast-content-type-parse && \
109+
rm fast-content-type-parse-2.0.1.tgz; \
110+
fi; \
111+
else \
112+
echo "Skipping @octokit/request patch - directory does not exist (may be patched in newer version)"; \
113+
fi
106114

107115
ENTRYPOINT ["sh", "/init.sh"]

generators/java/sdk/src/main/java/com/fern/java/client/generators/ClientOptionsGenerator.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private static Map<String, String> getPlatformHeadersEntries(
145145
platformHeaders.getSdkVersion(),
146146
generatorConfig.getPublish().get().getVersion());
147147
}
148-
// Fallback to IR publishConfig (local generation)
148+
// Fallback to IR publishConfig (local generation with explicit maven config)
149149
else if (ir.getPublishConfig().isPresent()) {
150150
Optional<MavenPublishTarget> mavenTarget =
151151
extractMavenTarget(ir.getPublishConfig().get());
@@ -157,6 +157,13 @@ else if (ir.getPublishConfig().isPresent()) {
157157
.ifPresent(version -> entries.put(platformHeaders.getSdkVersion(), version));
158158
}
159159
}
160+
// Final fallback: generate default coordinate matching Fiddle's RegistryConfigFactory behavior
161+
// This ensures local generation matches remote generation for GitHub output mode without explicit maven config
162+
else {
163+
String fallbackCoordinate = String.format(
164+
"com.%s.fern:%s-sdk", generatorConfig.getOrganization(), generatorConfig.getWorkspaceName());
165+
entries.put(platformHeaders.getSdkName(), fallbackCoordinate);
166+
}
160167

161168
if (platformHeaders.getUserAgent().isPresent()) {
162169
entries.put(

0 commit comments

Comments
 (0)