Skip to content

chore(deps): upgrading our OpenAPI dependencies#1169

Open
erunion wants to merge 11 commits into
mainfrom
feat/update-oas-deps
Open

chore(deps): upgrading our OpenAPI dependencies#1169
erunion wants to merge 11 commits into
mainfrom
feat/update-oas-deps

Conversation

@erunion

@erunion erunion commented Jun 26, 2026

Copy link
Copy Markdown
Member

🧰 Changes

This upgrades our dependencies on oas, oas-normalize, and @readme/oas-to-har to bring them up to date. A lot has changed within these packages over the last year, including the full removal of .dereference() and JSON Schema transformation APIs that we relied on here; as a result I've had to rework a number of internals in order to maintain parity with how we expect codegen to function.

@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 345f825

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
httpsnippet-client-api Minor
@readme/api-core Minor
api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@erunion erunion added the dependencies Pull requests that update a dependency file label Jun 26, 2026
})
.then(Oas.init)
.then(async spec => {
await spec.dereference({ preserveRefAsJSONSchemaTitle: true });

@erunion erunion Jun 26, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

transformer was removed from the oas earlier this year because it was only ever used within this library and did not to exist there.

.map(status => {
const schema = operation.getResponseAsJSONSchema(status, {
includeDiscriminatorMappingRefs: false,
transformer: (s: SchemaObject) => {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

transformer was removed from the oas earlier this year because it was only ever used within this library and did not to exist there.

Comment thread packages/api/package.json
"version": "npm run build:versioned-files && git add schema.json src/packageInfo.ts"
},
"dependencies": {
"@readme/api-core": "file:../core",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Had to change these package file references in order for these packages to get built properly under the new https://turborepo.dev/ build system.

Comment thread packages/api/package.json
@@ -70,7 +71,7 @@
"devDependencies": {
"@api/test-utils": "file:../test-utils",
"@readme/oas-examples": "^7.0.0",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oas-examples is also a full major release behind but I didn't want to bump that and explode the diff here with SDK fixtures changes. Will address at some point in a followup.

@erunion erunion requested a review from darrenyong June 26, 2026 22:59
"title": "app_patch",
"x-readme-ref-name": "app_patch"
"x-readme-ref-name": "app_patch",
"$schema": "http://json-schema.org/draft-04/schema#"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These $schema properties all got added because of some improvements we've made to JSON Schema generation in the oas library.

@darrenyong darrenyong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tried to review as best I could!

Comment on lines +110 to +136
// This may result in some data loss if there's already a `title` present, but in the case
// where we want to generate code for the API definition (see http://npm.im/api), we'd
// prefer to retain original reference name as a title for any generated types.
//
// This work used to exist within the `oas` library as a `preserveRefAsJSONSchemaTitle`
// option but was deprecated and removed in https://github.com/readmeio/oas/pull/1084.
if (spec?.components?.schemas && typeof spec.components?.schemas === 'object') {
Object.keys(spec.components.schemas).forEach(schemaName => {
// oxlint-disable-next-line no-param-reassign, no-unsafe-optional-chaining
(spec.components?.schemas?.[schemaName] as SchemaObject).title = schemaName;

// oxlint-disable-next-line no-param-reassign, no-unsafe-optional-chaining
(spec.components?.schemas?.[schemaName] as SchemaObject)['x-readme-ref-name'] = schemaName;
});
}

const normalize = new OASNormalize(spec, {
parser: {
dereference: {
circular: 'ignore',
},
},
});

return normalize.dereference();
})
.then(spec => spec as OASDocument)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

seems like this block of code already exists in test-utils/index as dereferenceAPI()

Comment on lines +194 to +197
const params: DataForHARWithFiles = jsonSchema ? getJSONSchemaDefaults(jsonSchema) : {};
if (!jsonSchema) {
return params;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are these checking the same thing?

Suggested change
const params: DataForHARWithFiles = jsonSchema ? getJSONSchemaDefaults(jsonSchema) : {};
if (!jsonSchema) {
return params;
}
if (!jsonSchema) {
return {};
}
const params: DataForHARWithFiles = getJSONSchemaDefaults(jsonSchema);

@erunion erunion marked this pull request as ready for review June 27, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants