Skip to content
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

Not return allProperties #52

Closed
dangthaison91 opened this issue Nov 15, 2017 · 2 comments
Closed

Not return allProperties #52

dangthaison91 opened this issue Nov 15, 2017 · 2 comments

Comments

@dangthaison91
Copy link
Contributor

dangthaison91 commented Nov 15, 2017

Seem that, current generator didn't return all model's properties as expected. When I user allProperties it return parentProperties only:

Expected:

context["allProperties"] = schema.properties.map(getPropertyContext) + schema.parentProperties.map(getPropertyContext)

Actual:

context["allProperties"] = schema.parentProperties.map(getPropertyContext)
@yonaskolb
Copy link
Owner

It does actually return all the properties. parentProperties is perhaps quite a misleading name. It is actually a property that returns a model's own properties and all those of it's parents, as can be seen here

    var parentProperties: [Property] {
        return parentRequiredProperties + parentOptionalProperties
    }

    private var parentRequiredProperties: [Property] {
        return (parent?.value.parentRequiredProperties ?? []) + requiredProperties
    }

    private var parentOptionalProperties: [Property] {
        return (parent?.value.parentOptionalProperties ?? []) + optionalProperties
    }

That getter should probably be renamed.

@yonaskolb
Copy link
Owner

Closing this for now. Let me know if you are seeing expected properties not being returned here

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

No branches or pull requests

2 participants