Skip to content

Commit

Permalink
chore: remove gem name from Ruby custom config (#2862)
Browse files Browse the repository at this point in the history
* add in output, this won't compile until fiddle and gen exec are upgraded

* update fiddle and exec

* bump version

* missing updates

* use the right seed

* add skip on streaming

* update changelog and don't fail streaming

* fix merge
  • Loading branch information
armandobelardo authored Feb 2, 2024
1 parent 5f5bbeb commit f58f17b
Show file tree
Hide file tree
Showing 96 changed files with 784 additions and 411 deletions.
96 changes: 48 additions & 48 deletions .pnp.cjs

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

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion generators/postman/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dockerTagVersion": "yarn dist:cli && docker build -f ./Dockerfile -t fernapi/fern-postman:${0} ."
},
"dependencies": {
"@fern-fern/generator-exec-sdk": "^0.0.472",
"@fern-fern/generator-exec-sdk": "^0.0.538",
"@fern-fern/ir-sdk": "0.0.2828",
"@fern-fern/postman-sdk": "0.0.46",
"@types/lodash": "^4.14.199",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@fern-api/generator-cli",
"name": "@fern-api/ruby-generator-cli",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "https://github.com/fern-api/fern.git",
"directory": "packages/generators/cli"
"directory": "generators/ruby/cli"
},
"private": true,
"files": [
Expand All @@ -29,10 +29,10 @@
"dependencies": {
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generator-commons": "workspace:*",
"@fern-api/ir-sdk": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.472",
"@fern-fern/generator-exec-sdk": "^0.0.538",
"@fern-fern/ir-sdk": "0.0.3294",
"tmp-promise": "^3.0.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { AbsoluteFilePath, join, RelativeFilePath } from "@fern-api/fs-utils";
import { GeneratorContext } from "@fern-api/generator-commons";
import { IntermediateRepresentation } from "@fern-api/ir-sdk";
import { CONSOLE_LOGGER, createLogger, Logger, LogLevel } from "@fern-api/logger";
import { createLoggingExecutable } from "@fern-api/logging-execa";
import { FernGeneratorExec } from "@fern-fern/generator-exec-sdk";
import * as GeneratorExecParsing from "@fern-fern/generator-exec-sdk/serialization";
import { IntermediateRepresentation } from "@fern-fern/ir-sdk/api";
import { cp, readdir, readFile } from "fs/promises";
import tmp from "tmp-promise";
import { GeneratorNotificationServiceImpl } from "./GeneratorNotificationService";
Expand All @@ -18,12 +18,6 @@ const LOG_LEVEL_CONVERSIONS: Record<LogLevel, FernGeneratorExec.logging.LogLevel
};

export abstract class AbstractGeneratorCli<CustomConfig> {
// TODO(fern-api): Dependent on update to Fiddle def: https://github.com/fern-api/fiddle/blob/main/fern/apis/generator-exec/definition/logging.yml#L26
// private registry: FernGeneratorExec.RegistryType;
// constructor(registry: FernGeneratorExec.RegistryType) {
// this.registry = registry;
// }

public async runCli(): Promise<void> {
const pathToConfig = process.argv[process.argv.length - 1];
if (pathToConfig == null) {
Expand Down Expand Up @@ -90,7 +84,7 @@ export abstract class AbstractGeneratorCli<CustomConfig> {
await loadIntermediateRepresentation(config.irFilepath)
);
},
github: async (githubOutputMode) => {
github: async (githubOutputMode: FernGeneratorExec.GithubOutputMode) => {
await this.writeForGithub(
config,
customConfig,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IntermediateRepresentation } from "@fern-api/ir-sdk";
import { serialization as IrSerialization } from "@fern-api/ir-sdk";
import { IntermediateRepresentation } from "@fern-fern/ir-sdk/api";
import * as IrSerialization from "@fern-fern/ir-sdk/serialization";
import { readFile } from "fs/promises";

export async function loadIntermediateRepresentation(pathToFile: string): Promise<IntermediateRepresentation> {
Expand Down
11 changes: 11 additions & 0 deletions generators/ruby/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "../../../shared/tsconfig.shared.json",
"compilerOptions": { "composite": true, "outDir": "lib", "rootDir": "src" },
"include": ["./src"],
"references": [
{ "path": "../../../packages/cli/logger" },
{ "path": "../../../packages/commons/fs-utils" },
{ "path": "../../../packages/commons/logging-execa" },
{ "path": "../../../packages/generators/commons" }
]
}
2 changes: 1 addition & 1 deletion generators/ruby/codegen/src/utils/RubyUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { GeneratedRubyFile } from "./GeneratedRubyFile";
import { TYPES_DIRECTORY } from "./RubyConstants";

export function getGemName(organization: string, apiName: string, clientClassName?: string, gemName?: string): string {
return snakeCase(gemName ?? getClientName(organization, apiName, clientClassName));
return gemName ?? snakeCase(getClientName(organization, apiName, clientClassName));
}

export function getClientName(organization: string, apiName: string, clientClassName?: string): string {
Expand Down
4 changes: 2 additions & 2 deletions generators/ruby/model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
},
"dependencies": {
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generator-cli": "workspace:*",
"@fern-api/generator-commons": "workspace:*",
"@fern-api/ruby-codegen": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.472",
"@fern-api/ruby-generator-cli": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.538",
"@fern-fern/ir-sdk": "0.0.3277",
"zod": "^3.22.3"
},
Expand Down
7 changes: 2 additions & 5 deletions generators/ruby/model/src/CustomConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ import { BaseGeneratorConfigSchema } from "@fern-api/generator-commons";
import { z } from "zod";

export type RubyModelCustomConfig = z.infer<typeof RubyModelCustomConfigSchema>;
export const RubyModelCustomConfigSchema = BaseGeneratorConfigSchema.extend({
gemName: z.optional(z.string())
});
export const RubyModelCustomConfigSchema = BaseGeneratorConfigSchema.extend({});

// TODO: this will likely be shared between models and SDK
export function parseCustomConfig(customConfig: unknown): RubyModelCustomConfig {
const parsed = customConfig != null ? RubyModelCustomConfigSchema.parse(customConfig) : undefined;
return {
extraDependencies: parsed?.extraDependencies ?? {},
clientClassName: parsed?.clientClassName,
gemName: parsed?.gemName
clientClassName: parsed?.clientClassName
};
}
Loading

0 comments on commit f58f17b

Please sign in to comment.