Skip to content

Conversation

gr2m
Copy link
Contributor

@gr2m gr2m commented Nov 10, 2020

This change now always exports an operations interface, even if there are no operations with operationIds. I think that works better for predictability.

I really like how the paths export becomes very nice overview of the whole schema, e.g. see github.ts

closes #341

@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

Merging #353 (bc10c32) into main (1a172c0) will increase coverage by 0.33%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #353      +/-   ##
==========================================
+ Coverage   92.57%   92.91%   +0.33%     
==========================================
  Files           5        5              
  Lines         256      268      +12     
  Branches       88       90       +2     
==========================================
+ Hits          237      249      +12     
  Misses         13       13              
  Partials        6        6              
Impacted Files Coverage Δ
src/v3.ts 96.26% <100.00%> (+0.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c7c1d8...bc10c32. Read the comment docs.

* Pet not found
*/
'404': unknown
put: operations['updatePet']
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻

/**
* Multiple status values can be provided with comma separated strings
*/
findPetsByStatus: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I’m curious how moving this JSDoc affects VS Code, if at all. Not really a concern; just curious (I actually received a lot of comments about this feature! It’s surprisingly popular)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question, I don't know but I'll check it out and report back

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in VS code the description now only shows up for operations["findPetsByStatus"], but not for paths["/pet/findByStatus"]["get"], which is a bummer ... I feel like that's something that should be fixed in the VS Code integration though ... I wouldn't add the same description to both places. We don't do that when we reference other components either. Let me know what you think

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah gotcha. Yeah I guess you could maybe hoist the comments, but that is one of the most annoying parts of the code. I wouldn‘t worry about it until someone raises it because it‘s not a great payoff

};
expect(swaggerToTS(schema)).toBe(
format(`
export interface operations {}
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 at first I was going to ask to not omit this if empty, but after thinking about it, I think I like always having it there, rather than being conditionally there or not. Seems safer to always omit

Copy link
Contributor

@drwpow drwpow left a comment

Choose a reason for hiding this comment

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

Looks great! 🎉

Normally I’d merge, but since you have contributor access now please feel free to merge whenever you’re ready. I can tag a new minor release as soon as it’s merged.

describe("cli", () => {
["github", "stripe", "manifold", "petstore"].forEach((file) => {
it(`reads ${file} spec (v3) from file`, () => {
it.only(`reads ${file} spec (v3) from file`, () => {
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 oops ☝🏼 will remove

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh my gosh didn‘t catch that. Glad you did!

/**
* Multiple status values can be provided with comma separated strings
*/
findPetsByStatus: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question, I don't know but I'll check it out and report back

@gr2m
Copy link
Contributor Author

gr2m commented Nov 11, 2020

no idea why tests fail on CI, they do not fail locally ... any idea what it might be?

@drwpow
Copy link
Contributor

drwpow commented Nov 11, 2020

no idea why tests fail on CI, they do not fail locally ... any idea what it might be?

Oh try rebasing off latest main; sorry. I added a test that needs to be updated.

@gr2m
Copy link
Contributor Author

gr2m commented Nov 11, 2020

try rebasing off latest main

🤦🏼 could have thought of that. On it

@gr2m gr2m force-pushed the 341/operations-interface branch from 31b2744 to bc10c32 Compare November 11, 2020 18:24
@gr2m
Copy link
Contributor Author

gr2m commented Nov 11, 2020

let me know what you think of #353 (comment). Other than that this is good to merge & release

@drwpow
Copy link
Contributor

drwpow commented Nov 11, 2020

let me know what you think of #353 (comment). Other than that this is good to merge & release

Oh sorry; I wasn‘t clear. This LGTM as-is; I wouldn‘t worry too much about it for now.

@gr2m gr2m merged commit bf009b7 into main Nov 11, 2020
@gr2m gr2m deleted the 341/operations-interface branch November 11, 2020 18:33
@drwpow
Copy link
Contributor

drwpow commented Nov 11, 2020

Published 2.4.0 with these changes just now

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.

export operations interface
2 participants