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
12 changes: 12 additions & 0 deletions fern-yml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3876,6 +3876,9 @@
"respectReadonlySchemas": {
"type": "boolean"
},
"useReadVariantForResponses": {
"type": "boolean"
},
"respectForwardCompatibleEnums": {
"type": "boolean"
},
Expand Down Expand Up @@ -4221,6 +4224,9 @@
}
]
},
"examples": {
"type": "string"
},
"name": {
"type": "string"
}
Expand Down Expand Up @@ -4444,6 +4450,9 @@
"respectReadonlySchemas": {
"type": "boolean"
},
"useReadVariantForResponses": {
"type": "boolean"
},
"respectForwardCompatibleEnums": {
"type": "boolean"
},
Expand Down Expand Up @@ -4789,6 +4798,9 @@
}
]
},
"examples": {
"type": "string"
},
"name": {
"type": "string"
}
Expand Down
1 change: 1 addition & 0 deletions fern/apis/generators-yml/definition/generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ types:
graphql: string
origin: optional<string>
overrides: optional<string>
examples: optional<string>
name: optional<string>

ProtobufSpecSchema:
Expand Down
10 changes: 10 additions & 0 deletions generators-yml.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2751,6 +2751,16 @@
}
]
},
"examples": {
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"name": {
"oneOf": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# yaml-language-server: $schema=../../../../../fern-changes-yml.schema.json

- summary: |
Bump @fern-api/generator-cli to 0.9.35, which disables minimatch negation
on `.fernignore` patterns so a stray `!pattern` no longer silently inverts
the match and discards generator output.
type: fix
9 changes: 9 additions & 0 deletions generators/python/sdk/versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
- version: 5.14.2
changelogEntry:
- summary: |
Bump @fern-api/generator-cli to 0.9.35, which disables minimatch negation
on `.fernignore` patterns so a stray `!pattern` no longer silently inverts
the match and discards generator output.
type: fix
createdAt: "2026-05-21"
irVersion: 67
- version: 5.14.1
changelogEntry:
- summary: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# yaml-language-server: $schema=../../../../../fern-changes-yml.schema.json

- summary: |
Bump @fern-api/generator-cli to 0.9.35, which disables minimatch negation
on `.fernignore` patterns so a stray `!pattern` no longer silently inverts
the match and discards generator output.
type: fix
9 changes: 9 additions & 0 deletions generators/typescript/sdk/versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# yaml-language-server: $schema=../../../fern-versions-yml.schema.json
- version: 3.71.1
changelogEntry:
- summary: |
Bump @fern-api/generator-cli to 0.9.35, which disables minimatch negation
on `.fernignore` patterns so a stray `!pattern` no longer silently inverts
the match and discards generator output.
type: fix
createdAt: "2026-05-21"
irVersion: 67
- version: 3.71.0
changelogEntry:
- summary: |
Expand Down
47 changes: 44 additions & 3 deletions packages/cli/api-importers/graphql/src/GraphQLConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,60 @@ export interface GraphQLConverterResult {
types: Record<FdrAPI.TypeId, FdrAPI.api.v1.register.TypeDefinition>;
}

export interface GraphQlExampleInput {
name?: string;
description?: string;
query: string;
variables?: Record<string, unknown>;
response?: unknown;
}

export interface GraphQlOperationExamplesInput {
operation: string;
operationType?: "query" | "mutation" | "subscription";
examples: GraphQlExampleInput[];
}

export class GraphQLConverter {
private schema: GraphQLSchema | undefined;
private context: TaskContext;
private filePath: AbsoluteFilePath;
private namespace: string | undefined;
private processingTypes: Set<string> = new Set();
private types: Record<FdrAPI.TypeId, FdrAPI.api.v1.register.TypeDefinition> = {};
private examplesByOperation: Map<string, FdrAPI.api.v1.register.GraphQlExample[]> = new Map();

constructor({
context,
filePath,
namespace
}: { context: TaskContext; filePath: AbsoluteFilePath; namespace?: string }) {
namespace,
examples
}: {
context: TaskContext;
filePath: AbsoluteFilePath;
namespace?: string;
examples?: GraphQlOperationExamplesInput[];
}) {
this.context = context;
this.filePath = filePath;
this.namespace = namespace;
if (examples != null) {
for (const entry of examples) {
const mapped = entry.examples.map((ex) => ({
name: ex.name ?? undefined,
description: ex.description ?? undefined,
query: ex.query,
variables: ex.variables ?? undefined,
response: ex.response ?? undefined
}));
if (entry.operationType != null) {
const key = `${entry.operationType.toLowerCase()}:${entry.operation}`;
this.examplesByOperation.set(key, mapped);
} else {
this.examplesByOperation.set(entry.operation, mapped);
}
}
}
}

private isBuiltInScalar(typeName: string): boolean {
Expand Down Expand Up @@ -249,6 +287,9 @@ export class GraphQLConverter {
operationType: FdrAPI.api.v1.register.GraphQlOperationType
): FdrAPI.api.v1.register.GraphQlOperation {
const args = field.args.map((arg) => this.convertArgument(arg));
const examples =
this.examplesByOperation.get(`${operationType.toLowerCase()}:${name}`) ??
this.examplesByOperation.get(name);

return {
id: this.getNamespacedOperationId(`${operationType.toLowerCase()}_${name}`),
Expand All @@ -259,7 +300,7 @@ export class GraphQLConverter {
availability: undefined,
arguments: args.length > 0 ? args : undefined,
returnType: this.convertOutputType(field.type),
examples: undefined,
examples: examples != null && examples.length > 0 ? examples : undefined,
snippets: undefined
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/api-importers/graphql/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export type { GraphQLConverterResult } from "./GraphQLConverter.js";
export type { GraphQLConverterResult, GraphQlExampleInput, GraphQlOperationExamplesInput } from "./GraphQLConverter.js";
export { GraphQLConverter } from "./GraphQLConverter.js";
Loading
Loading