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

Spike: can we simplify the GraphQL types? #3024

Closed
wants to merge 1 commit into from

Conversation

brucebolt
Copy link
Member

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the publishing platform team. Please let us know in #govuk-publishing-platform when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

Copy link
Member

@yndajas yndajas left a comment

Choose a reason for hiding this comment

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

Some questions to discuss when we get to it!

@@ -23,8 +47,12 @@ class WithdrawnNotice < Types::BaseObject
field :rendering_app, String
field :scheduled_publishing_delay_seconds, Int
field :schema_name, String
field :slug, String, null: false
field :started_on, GraphQL::Types::ISO8601DateTime
field :supports_historical_accounts, Boolean
Copy link
Member

Choose a reason for hiding this comment

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

thought: approach

I'd be interested in discussing what our priorities are in terms of simplification vs clarity. Here are some questions off the top of my head (I haven't formed an opinion yet!):

  1. Here we might end up with one big edition type with fields that might or might not exist on a given document based on its type: will we then lose the ability to know whether a given document should have certain fields/links?
  2. Does the distinction between nullish data and invalid properties matter?
  3. Do we want GraphQL query clients to be able to make use of a complex schema for introspection, so that the clients can guide us on what could/should exist on a given document based on its type (this change would presumably mean they'd just suggest every field for every edition/link)?
  4. Do we want client apps to know via error if they're asking for data that will never exist on a given type (perhaps they're using it in a view and not realising it will always be null)?
  5. Is the benefit here mostly that we don't need to define fields on multiple types?
  6. Is this better than just moving the shared stuff into the edition type?
  7. Is everything technically shared, and just null on certain types?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is everything technically shared, and just null on certain types?

This was my assumption when I started looking into this, on the basis that Publishing API can theoretically have any of these things on any document type in it's database, it's just we exclude them from being allowed by validating against a schema when the publishing application makes a request.

I don't know if it's possible (or even a good idea), but maybe we could validate GraphQL queries against the schemas too, so you can't request a field that isn't in that document's schema?

(Writing the answer to this question here, so I don't forgot before we mob)

EDITION_TYPES = [Types::EditionType, Types::RoleType, Types::WorldIndexType, Types::MinistersIndexType].freeze
EDITION_TYPES = [Types::EditionType].freeze
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: tidy up

If we do go down this route, I'd have thought this class/type resolution could be fully deleted. I don't think it's doing anything meaningful with the edition type descendants removed

@brucebolt brucebolt force-pushed the spike-flatten-graphql-edition branch from d2c455d to f4d6952 Compare December 19, 2024 16:13
@brucebolt
Copy link
Member Author

Closing in favour of #3063.

@brucebolt brucebolt closed this Jan 2, 2025
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.

2 participants