Skip to content

Commit fa32663

Browse files
committed
refactor: Align codegen scripts and imports with seamapi/docs
- Add lint, postlint, and preformat scripts using @seamapi/smith/eslint-config via a one-line eslint.config.ts, matching seamapi/docs - Replace relative parent imports with lib/* path imports (tsconfig baseUrl and paths), satisfying import/no-relative-parent-imports and matching the smith import sort convention - Mark every file and function that exists only for output parity with a TEMPORARY banner and a TODO to delete it once generated output is allowed to change, so temp code is skippable in review Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019iX1vWXfXKzUyRJTVm8D7s
1 parent aec7ed2 commit fa32663

14 files changed

Lines changed: 91 additions & 42 deletions

codegen/lib/endpoint-rules.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
// Ported from @seamapi/nextlove-sdk-generator lib/endpoint-rules.ts.
1+
// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator
2+
// lib/endpoint-rules.ts. These lists only preserve legacy generated output:
3+
// the ignored paths reproduce the previous endpoint filtering, and the
4+
// deprecated action attempt list keeps those endpoints returning None.
5+
// TODO: Delete this file once generated output is allowed to change; filter
6+
// on blueprint undocumented flags instead and let the deprecated endpoints
7+
// return their real response types.
28

39
export const endpointsReturningDeprecatedActionAttempt = [
410
'/access_codes/delete',

codegen/lib/layouts/models.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
import { pascalCase } from 'change-case'
66

7-
import { type ClassModel } from '../class-model.js'
8-
import { convertCustomResourceName } from '../custom-resource-name-conversions.js'
9-
import { mapPythonType } from '../map-python-type.js'
10-
import { flattenObjSchema } from '../openapi/flatten-obj-schema.js'
11-
import type { ObjSchema, OpenapiSchema } from '../openapi/types.js'
7+
import type { ClassModel } from 'lib/class-model.js'
8+
import { convertCustomResourceName } from 'lib/custom-resource-name-conversions.js'
9+
import { mapPythonType } from 'lib/map-python-type.js'
10+
import { flattenObjSchema } from 'lib/openapi/flatten-obj-schema.js'
11+
import type { ObjSchema, OpenapiSchema } from 'lib/openapi/types.js'
12+
1213
import { getMethodLayoutContext } from './route.js'
1314

1415
export interface ModelsLayoutContext {

codegen/lib/layouts/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
type ClassMethod,
66
type ClassModel,
77
sortClassMethodParameters,
8-
} from '../class-model.js'
8+
} from 'lib/class-model.js'
99

1010
export interface MethodLayoutContext {
1111
name: string

codegen/lib/map-python-type.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
// Ported from @seamapi/nextlove-sdk-generator lib/generate-python-sdk/map-python-type.ts.
2-
// TODO: Derive types from @seamapi/blueprint parameter and property formats
3-
// once generated output is allowed to change. Blueprint collapses the OpenAPI
4-
// integer type into its number format, but the generated output distinguishes
5-
// int from float, so the raw OpenAPI schema is used here instead.
1+
// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator
2+
// lib/generate-python-sdk/map-python-type.ts. This is a frozen output-parity
3+
// workaround: it exists only so the generated output stays byte-identical to
4+
// the previous generator. Do not review, refactor, or improve it.
5+
// TODO: Delete this file and derive types from @seamapi/blueprint parameter
6+
// and property formats once generated output is allowed to change. Blueprint
7+
// collapses the OpenAPI integer type into its number format, but the
8+
// generated output distinguishes int from float, so the raw OpenAPI schema is
9+
// used here instead.
610

711
import { deepFlattenOneOfAndAllOfSchema } from './openapi/deep-flatten-one-of-and-all-of-schema.js'
812
import type { PrimitiveSchema, PropertySchema } from './openapi/types.js'

codegen/lib/openapi/deep-flatten-one-of-and-all-of-schema.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
// Ported from @seamapi/nextlove-sdk-generator lib/openapi/deep-flatten-one-of-and-all-of-schema.ts.
2-
// TODO: Use parameter formats from @seamapi/blueprint once generated output is
3-
// allowed to change.
1+
// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator
2+
// lib/openapi/deep-flatten-one-of-and-all-of-schema.ts. This OpenAPI parsing
3+
// is a frozen output-parity workaround: it exists only so the generated
4+
// output stays byte-identical to the previous generator. Do not review,
5+
// refactor, or improve it.
6+
// TODO: Delete this file and use parameter formats from @seamapi/blueprint
7+
// once generated output is allowed to change.
48

59
import type {
610
AllOfSchema,

codegen/lib/openapi/flatten-obj-schema.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
// Ported from @seamapi/nextlove-sdk-generator lib/openapi/flatten-obj-schema.ts.
2-
// The lodash intersectionWith(isEqual) call was replaced with a plain
3-
// string-array intersection: required arrays only ever contain strings, so the
4-
// semantics are identical.
5-
// TODO: Use resource properties from @seamapi/blueprint once generated output
6-
// is allowed to change.
1+
// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator
2+
// lib/openapi/flatten-obj-schema.ts (with the lodash intersectionWith(isEqual)
3+
// call replaced by a plain string-array intersection; required arrays only
4+
// ever contain strings, so the semantics are identical). This is a frozen
5+
// output-parity workaround: it exists only so the generated output stays
6+
// byte-identical to the previous generator. Do not review, refactor, or
7+
// improve it.
8+
// TODO: Delete this file and use resource properties from @seamapi/blueprint
9+
// once generated output is allowed to change.
710

811
import type {
912
AllOfSchema,

codegen/lib/openapi/get-filtered-routes.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
// Ported from @seamapi/nextlove-sdk-generator lib/openapi/get-filtered-routes.ts.
2-
// TODO: Use route.isUndocumented from @seamapi/blueprint once generated output
3-
// is allowed to change.
1+
// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator
2+
// lib/openapi/get-filtered-routes.ts. This is a frozen output-parity
3+
// workaround: it exists only so the generated output stays byte-identical to
4+
// the previous generator. Do not review, refactor, or improve it.
5+
// TODO: Delete this file and use route.isUndocumented from @seamapi/blueprint
6+
// once generated output is allowed to change.
47

58
import type { OpenapiSchema, Route } from './types.js'
69

codegen/lib/openapi/get-parameter-and-response-schema.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
// Ported from @seamapi/nextlove-sdk-generator lib/openapi/get-parameter-and-response-schema.ts.
2-
// TODO: Use endpoint.request.parameters and endpoint.response from
3-
// @seamapi/blueprint once generated output is allowed to change.
1+
// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator
2+
// lib/openapi/get-parameter-and-response-schema.ts. This OpenAPI parsing is a
3+
// frozen output-parity workaround: it exists only so the generated output
4+
// stays byte-identical to the previous generator. Do not review, refactor, or
5+
// improve it.
6+
// TODO: Delete this file and use endpoint.request.parameters and
7+
// endpoint.response from @seamapi/blueprint once generated output is allowed
8+
// to change.
49

510
import { deepFlattenOneOfAndAllOfSchema } from './deep-flatten-one-of-and-all-of-schema.js'
611
import { flattenObjSchema } from './flatten-obj-schema.js'

codegen/lib/openapi/map-parent-to-children-resource.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
// Ported from @seamapi/nextlove-sdk-generator lib/openapi/map-parent-to-children-resource.ts.
2-
// Only the first two segments of x-fern-sdk-group-name are considered, so
3-
// deeply nested namespaces (e.g. acs.encoders.simulate) are generated as
4-
// standalone classes but never wired to a parent property.
5-
// TODO: Wire deeply nested namespaces to a property on their parent class
6-
// once generated output is allowed to change. Until then, do not "fix"
7-
// this: the generated output must stay identical.
8-
// TODO: Use blueprint.namespaces parent/child relationships once generated
9-
// output is allowed to change.
10-
11-
import { ignoredEndpointPaths } from '../endpoint-rules.js'
1+
// TEMPORARY: Verbatim port of @seamapi/nextlove-sdk-generator
2+
// lib/openapi/map-parent-to-children-resource.ts. This is a frozen
3+
// output-parity workaround: it exists only so the generated output stays
4+
// byte-identical to the previous generator. Do not review, refactor, or
5+
// improve it. Only the first two segments of x-fern-sdk-group-name are
6+
// considered, so deeply nested namespaces (e.g. acs.encoders.simulate) are
7+
// generated as standalone classes but never wired to a parent property.
8+
// TODO: Delete this file and use blueprint.namespaces parent/child
9+
// relationships once generated output is allowed to change, wiring deeply
10+
// nested namespaces to a property on their parent class at the same time.
11+
12+
import { ignoredEndpointPaths } from 'lib/endpoint-rules.js'
13+
1214
import type { Route } from './types.js'
1315

1416
export const mapParentToChildResources = (

codegen/lib/openapi/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// Minimal OpenAPI types ported from @seamapi/nextlove-sdk-generator.
2-
// TODO: Delete this module and use @seamapi/blueprint types once generated
1+
// TEMPORARY: Minimal OpenAPI types ported from @seamapi/nextlove-sdk-generator.
2+
// These only support the frozen output-parity workarounds in this directory.
3+
// Do not review, refactor, or improve them.
4+
// TODO: Delete this file and use @seamapi/blueprint types once generated
35
// output is allowed to change.
46

57
export interface PrimitiveSchema {

0 commit comments

Comments
 (0)