Skip to content

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

Merged
merged 2 commits into from
May 29, 2018

Conversation

dunglas
Copy link
Member

@dunglas 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

@dunglas dunglas requested review from soyuka, mauchede and mysiar May 29, 2018 12:45
Copy link
Member

@soyuka soyuka left a 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 => {

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);

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);

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);

Choose a reason for hiding this comment

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

({ deprecated }) => !deprecated

@dunglas dunglas merged commit 0000d72 into api-platform:master May 29, 2018
@dunglas dunglas deleted the deprecated branch May 29, 2018 16:31
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