-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: Create @loopback/openapi-v2 #804
Conversation
fca4e22
to
c4b8c94
Compare
c4b8c94
to
9c06d96
Compare
Since this is mostly moving files around, there is little to review here. The changes look reasonable after a quick review. My only objection is against the package name |
@bajtos Thanks for review, this package will contain all of the openapi spec generation code, like function Functions like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
9c06d96
to
72b7a9b
Compare
@jannyHou The module is the home for openapi related metadata, including decorators for describing the metadata and utility methods for inspecting the metadata. It makes sense to me to name it as |
That's true, And I prefer @raymondfeng I had a talk with @kjdelisle, we think at this moment |
5b7ebb7
to
3d8a998
Compare
packages/openapi-v2/README.md
Outdated
|
||
This package contains: | ||
|
||
- Decorators that describe LoopBack artifacts as metadata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decorators that apply REST api mapping metadata to controller classes and their members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raymondfeng as I have mentioned in #804 (comment), my intension to have this package is to organize all the openapi related decorators and spec generation functions together. Not only for controller classes....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raymondfeng How about "Decorators that describe LoopBack artifacts as openapi metadata."? I missed an important word "openapi" in this commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These decorators are created for application developers to describe REST mapping of controller classes, right?
packages/openapi-v2/README.md
Outdated
This package contains: | ||
|
||
- Decorators that describe LoopBack artifacts as metadata. | ||
- Uilities that tranfer LoopBack remoting metadata to swagger specifications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Utilities that inspect controller classes to build OpenAPI v2 (Swagger) specifications from REST api mapping metadata.
## Overview | ||
|
||
The package has functions described above for LoopBack controller classes. | ||
Decorators apply REST api mapping metadata to controller classes and their members. And utilities that inspect controller classes to build OpenAPI v2 (Swagger) specifications from REST api mapping metadata. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of the This package contains
section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raymondfeng There is a difference: the top level description is for ALL artifacts :) And the Overview
section says currently what the package has(functions for controller classes). And we will add more for other artifacts if need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there! Just need a couple quick fixes:
- Rename the
openapi-spec
package toopenapi-v2-spec
to make it clear which version of the OpenAPI specification this package is meant to represent. - Add in the missing newlines
- Reword the commit message to say
feat: Create @loopback/openapi-v2-spec
- Bump the minimum engine to 8.
@@ -0,0 +1,3 @@ | |||
*.tgz | |||
dist* | |||
package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline
@@ -0,0 +1 @@ | |||
package-lock=false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
packages/openapi-v2/package.json
Outdated
"version": "1.0.0-alpha1", | ||
"description": "Processes openapi v2 related metadata", | ||
"engines": { | ||
"node": ">=6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set this to >=8
, as we've decided not to support Node 6 for our release.
}, | ||
"include": ["src", "test"] | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
packages/openapi-v2/README.md
Outdated
This package contains: | ||
|
||
- Decorators that describe LoopBack artifacts as OpenAPI v2 (Swagger) metadata. | ||
- Utilities that tranfer LoopBack metadata to OpenAPI v2 (Swagger) swagger specifications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: transfer
This is out of the scope of this PR and I don't think it's a quick fix. A simple replacement affects 50 files and we also need to check example repos. I will address it in the next PR(upgrading from v2-->v3) |
754044e
to
2faaae5
Compare
Agreed, as long as the newline fixes are put into place, LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/openapi-v2/package.json
Outdated
"api-docs", | ||
"src" | ||
], | ||
"repository": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the following so that the package will be published with public
access with npm run release
.
"publishConfig": {
"access": "public"
},
2faaae5
to
d5fde90
Compare
Do you want to change the commit message to be |
d5fde90
to
b1b1c73
Compare
@raymondfeng 😀 my bad, forgot to change the commit message. |
@@ -25,6 +25,7 @@ | |||
"dependencies": { | |||
"@loopback/context": "^4.0.0-alpha.24", | |||
"@loopback/core": "^4.0.0-alpha.26", | |||
"@loopback/openapi-v2": "1.0.0-alpha1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jannyHou The version number should have been 1.0.0-alpha.1
(notice the dot between "alpha" and "1"), this is the scheme we are using in other packages (look at lines 26 and 27 above for examples).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Raymond already created a PR to fix the version.
connect to #753
Replace #800
openapi-specgen
rest
toopenapi-specgen
I will put more release details after the code looks good.