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

Supported nested fields #1695

Closed
wants to merge 16 commits into from
Closed

Conversation

Ben-Ho
Copy link
Contributor

@Ben-Ho Ben-Ho commented Feb 13, 2024

open points

  • move grid changes into follow-up pull-request
  • decide if we should use UsableFields (Supported nested fields #1695 (comment))
  • merge extended demo from next and maybe fixed packageDimensions from main
  • remove objectSuffix from recursiveStringify
  • maybe follow-up pull-request for checkable fieldset? -> conditional-fields will be added later
  • handle optional number field bug?

@Ben-Ho Ben-Ho self-assigned this Feb 13, 2024
@Ben-Ho Ben-Ho mentioned this pull request Feb 13, 2024
@nsams
Copy link
Member

nsams commented Feb 19, 2024

would this work correctly?

packageDimensions: {
    width: number;
    height: number;
    depth: number;
    textfield: string;
    booleanfield: boolean;
    nestingtwo: {
        numberfield: number;
        textfield: string
    }
}

(maybe we should extend the demo)

Copy link
Collaborator

@johnnyomair johnnyomair left a comment

Choose a reason for hiding this comment

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

I had a really hard time reviewing this. Lot's of refactors, lot's of similar functions that are slightly different in detail. Also, most functions are rather hard to read.

Maybe adding more commits for smaller changes would have been preferable?

@Ben-Ho
Copy link
Contributor Author

Ben-Ho commented Feb 20, 2024

I had a really hard time reviewing this. Lot's of refactors, lot's of similar functions that are slightly different in detail. Also, most functions are rather hard to read.

I also underestimated this change. I thought simply improving the types, and handle the dot notation in the query would do the trick, but it needed changes to many places... and it seems it's not even ready now, as I found there are many issues with generated grid...

@Ben-Ho
Copy link
Contributor Author

Ben-Ho commented Feb 20, 2024

would this work correctly?

packageDimensions: {
    width: number;
    height: number;
    depth: number;
    textfield: string;
    booleanfield: boolean;
    nestingtwo: {
        numberfield: number;
        textfield: string
    }
}

(maybe we should extend the demo)

I didn't test this level of nesting, but I think there should be no limit. I'll extend the demo to test this.

@Ben-Ho
Copy link
Contributor Author

Ben-Ho commented Feb 20, 2024

and it seems it's not even ready now, as I found there are many issues with generated grid...

I'm thinking about opening another pull-request for grid-support, but there are some functions required for both implementations. So even if it doubles the changes I think it's similar enough for the argument to keep it together.

@nsams
Copy link
Member

nsams commented Feb 20, 2024

I'm thinking about opening another pull-request for grid-support, but there are some functions required for both implementations. So even if it doubles the changes I think it's similar enough for the argument to keep it together.

make it dependent on this one!

@Ben-Ho
Copy link
Contributor Author

Ben-Ho commented Feb 20, 2024

(maybe we should extend the demo)

I came up with some product-related entities containing double nesting and optional fields. should I add it to this PR or with a separate one?

part of schema.gql

type AlternativeAddress {
  street: String!
  streetNumber: Float
  zip: Float!
  country: String!
}

type Address {
  street: String!
  streetNumber: Float
  zip: Float!
  country: String!
  alternativeAddress: AlternativeAddress
}

type AlternativeAddressAsEmbeddable {
  street: String!
  streetNumber: Float
  zip: Float!
  country: String!
}

type AddressAsEmbeddable {
  street: String!
  streetNumber: Float
  zip: Float!
  country: String!
  alternativeAddress: AlternativeAddressAsEmbeddable
}

type Manufacturer {
  id: ID!
  address: Address
  addressAsEmbeddable: AddressAsEmbeddable
  updatedAt: DateTime!
}

@nsams
Copy link
Member

nsams commented Feb 21, 2024

should I add it to this PR or with a separate one?

👍 please create a separate PR

@Ben-Ho
Copy link
Contributor Author

Ben-Ho commented Feb 21, 2024

👍 please create a separate PR

done: #1729

- `packageDimensions` was nullable, although the database fields aren't
nullable (caused an DB error if null was saved)
- Admin Generator (present and future) doesn't support nested fields
(for future it is WIP, present will never get it)
- Easy solution: remove it
- #1729 will showcase nested fields and everything (as replacement for
packageDimensions)
@Ben-Ho Ben-Ho force-pushed the admin-gen-configurable_support-nested branch from f29211c to 357f7f5 Compare February 23, 2024 11:10
@Ben-Ho Ben-Ho force-pushed the admin-gen-configurable_support-nested branch from a3cf65a to b672bf9 Compare February 23, 2024 11:26
@Ben-Ho Ben-Ho force-pushed the admin-gen-configurable_support-nested branch from cae5610 to 1cc85e6 Compare February 23, 2024 11:37
@johnnyomair
Copy link
Collaborator

Marking this as draft until #1751 and #1759 have been merged.

@johnnyomair johnnyomair marked this pull request as draft February 29, 2024 08:24
@Ben-Ho Ben-Ho marked this pull request as ready for review March 29, 2024 11:12
@auto-assign auto-assign bot requested a review from johnnyomair March 29, 2024 11:12
@Ben-Ho Ben-Ho requested a review from nsams March 29, 2024 11:12
@johnnyomair johnnyomair deleted the admin-gen-configurable_support-nested branch April 11, 2024 14:58
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