-
-
Notifications
You must be signed in to change notification settings - Fork 131
Ignore deprecated resources and fields #78
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
Conversation
dunglas
commented
May 29, 2018
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | n/a |
License | MIT |
Doc PR | n/a |
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
src/index.js
Outdated
@@ -30,15 +30,19 @@ const generator = generators(program.generator)({ | |||
const resourceToGenerate = program.resource ? program.resource.toLowerCase() : null; | |||
|
|||
parseHydraDocumentation(entrypoint).then(ret => { | |||
for (let resource of ret.api.resources) { | |||
ret.api.resources.filter(resource => !resource.deprecated).forEach(resource => { |
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.
({ deprecated }) => !deprecated
src/index.js
Outdated
const nameLc = resource.name.toLowerCase(); | ||
const titleLc = resource.title.toLowerCase(); | ||
|
||
if (null === resourceToGenerate || nameLc === resourceToGenerate || titleLc === resourceToGenerate) { | ||
resource.fields = resource.fields.filter(field => !field.deprecated); |
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.
({ deprecated }) => !deprecated
src/index.js
Outdated
const nameLc = resource.name.toLowerCase(); | ||
const titleLc = resource.title.toLowerCase(); | ||
|
||
if (null === resourceToGenerate || nameLc === resourceToGenerate || titleLc === resourceToGenerate) { | ||
resource.fields = resource.fields.filter(field => !field.deprecated); | ||
resource.readableFields = resource.readableFields.filter(field => !field.deprecated); |
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.
({ deprecated }) => !deprecated
src/index.js
Outdated
const nameLc = resource.name.toLowerCase(); | ||
const titleLc = resource.title.toLowerCase(); | ||
|
||
if (null === resourceToGenerate || nameLc === resourceToGenerate || titleLc === resourceToGenerate) { | ||
resource.fields = resource.fields.filter(field => !field.deprecated); | ||
resource.readableFields = resource.readableFields.filter(field => !field.deprecated); | ||
resource.writableFields = resource.writableFields.filter(field => !field.deprecated); |
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.
({ deprecated }) => !deprecated