Skip to content

Conversation

@jefflembeck
Copy link
Contributor

@jefflembeck jefflembeck commented May 20, 2025

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you written unit tests?
  • Have you written unit tests that cover the negative cases (i.e.: if bad data is submitted, does the library respond properly)?
  • This PR is associated with an existing issue?

Closing issues

This addresses number #794.

Put closes #XXXX (where XXXX is the issue number) in your comment to auto-close the issue that your PR fixes.

Potential Problems With The Approach

There is probably way too much here. I cargo culted a ton of things over from 3.0.0. I also made some changes to how certain types extend others.

Test plan

Broke out tests and fixtures strictly for 3.1. Happy to make changes to that, but wanted something we could start talking out earlier rather than later.

This involved breaking 2 and 3 out a little to better mirror the
differences in the specs
@jefflembeck jefflembeck changed the title Openapi 3dot1 Open API 3.1.0 support May 20, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there jefflembeck 👋

Thank you and congrats 🎉 for opening your first PR on this project.✨

We will review the following PR soon! 👀

@jefflembeck
Copy link
Contributor Author

My real issue I wanted to get to the bottom of was getting variadic tuples in. But the differences in prefixItems and items and what is possible for 3.1.0 vs 3.0.0 made me shoot for the moon a little.

@bioc-druzgami
Copy link

Any news?

@WoH
Copy link
Collaborator

WoH commented Sep 24, 2025

I started on this, but I am very much beyond my capacity until October unfortunately.
This one's a big improvement, and I need want to make time to fix the CI, dependencies and rebase this one onto a green CI.

import { DEFAULT_REQUEST_MEDIA_TYPE, DEFAULT_RESPONSE_MEDIA_TYPE, getValue } from './../utils/swaggerUtils';
import { SpecGenerator } from './specGenerator';

export class SpecGenerator31 extends SpecGenerator {
Copy link
Collaborator

Choose a reason for hiding this comment

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

First glance, this is probably better extending SpecGenerator3, have you considered that option?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did. This was actually something I wanted to talk about a little. This part fully got away from me. Differences between examples was my start.

},
err => {
expect(err.message).to.equal('Unsupported Spec version.');
expect(err.message).to.equal('Unsupported Spec version: -2.');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why -2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, that's just me outputting the spec version that is wrong. (That's the -2 from above)

I made this change while I was working because it made a few things easier to figure out.

Comment on lines +33 to 43
if (swaggerConfig.specVersion) {
if (swaggerConfig.specVersion === 3) {
spec = new SpecGenerator3(metadata, swaggerConfig).GetSpec();
} else if (swaggerConfig.specVersion === 3.1) {
spec = new SpecGenerator31(metadata, swaggerConfig).GetSpec();
} else {
spec = new SpecGenerator2(metadata, swaggerConfig).GetSpec();
}
} else {
spec = new SpecGenerator2(metadata, swaggerConfig).GetSpec();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am fine with making 3.1 a default in the scope of a major release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants