Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): fix type reference schemas #4701

Merged
merged 5 commits into from
Sep 19, 2024
Merged

Conversation

dsinghvi
Copy link
Member

@dsinghvi dsinghvi commented Sep 19, 2024

Human Summary

  • Fixes a bug where we updated the OpenAPI converter to generate invalid type references with titles
  • Refactor TypeReferenceSchema.ts so that its easier to add to over time

AI Generated Summary

This PR introduces changes to the TypeReferenceSchema and VariableDeclarationSchema in the fern-definition and openapi-ir-to-fern packages.

Changes

  • The TypeReferenceSchema is now imported from the TypeReferenceSchema.ts file instead of the TypeReferenceWithDocsAndAvailabilitySchema.ts file.
  • The VariableDeclarationSchema is now defined as a union of a string and a strict object with a type property and an extension of the WithDocsSchema.shape.
  • The TypeReferenceSchema is now exported as a constant and a type, with the constant being defined as the result of calling the extendTypeReferenceSchema function with an object shape as an argument.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The TypeReferenceWithDocsAndDisplayNameAndAvailabilitySchema is now returned by the buildPrimitiveTypeReference, buildBooleanTypeReference, buildLongTypeReference, buildStringTypeReference, buildIntegerTypeReference, buildFloatTypeReference, buildDoubleTypeReference, buildReferenceTypeReference, buildArrayTypeReference, buildMapTypeReference, buildOptionalTypeReference, buildUnknownTypeReference, buildLiteralTypeReference, buildEnumTypeReference, buildObjectTypeReference, and buildOneOfTypeReference functions.
  • The `TypeReferenceWithDocsAnd

"js-yaml": "^4.1.0",
"lodash-es": "^4.17.21",
"yargs": "^17.4.1"
"dist:cli": "pnpm compile && tsup ./src/cli.ts --format cjs",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved our script cli to tsup and off of the old stuff

Comment on lines +25 to +30
const filepath = argv.filepath;
const jsonSchema = zodToJsonSchema(DefinitionFileSchema, "Fern Definition");
const jsonSchemaStr = JSON.stringify(jsonSchema);
const config = (await prettier.resolveConfig(filepath)) ?? undefined;
const jsonSchemaFormatted = prettier.format(jsonSchemaStr, { ...config, filepath });
await writeFile(filepath, jsonSchemaFormatted);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd consider consolidating this into fewer lines to keep things a little more terse, but I get it if you like the readability as-is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i just kept the function the same as what it used to be (just copy pastad it)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will just leave as is to keep things moving

@dsinghvi dsinghvi enabled auto-merge (squash) September 19, 2024 19:45
@dsinghvi dsinghvi merged commit 807b43e into main Sep 19, 2024
46 checks passed
@dsinghvi dsinghvi deleted the dsinghvi/fix-type-reference branch September 19, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants