router icon indicating copy to clipboard operation
router copied to clipboard

Expose endpoint to get string representing federation spec definition at version number

Open conwuegb opened this issue 6 months ago • 3 comments

This change

  • exposes get_federation_spec_definition_string_from_version(...) to allow clients to get a String representation of FederationSpecDefinition at a specified version number
  • updates schema_as_fed2_subgraph(...) to take a version number, in order to expand the schema accordingly per version
  • updates validate_federation_imports(...) to dynamically generate imports instead of relying on hard-coded arrays, which were out of date
  • makes a small fix to @fromContext directive's argument spec (arg name was incorrect, and arg was marked as non-nullable)

[!NOTE]

the @link directive is not included in this change, given federation's current implementation so the following substring will not appear in the output of get_federation_spec_definition_string_from_version(...):

directive @link(url: String!, as: String, import: [Import], for: Purpose) repeatable on SCHEMA
scalar Import
enum Purpose {
    SECURITY
    EXECUTION
}

Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • [x] Changes are compatible[^1]
  • [ ] Documentation[^2] completed
  • [ ] Performance impact assessed and acceptable
  • [ ] Metrics and logs are added[^3] and documented
  • Tests added and passing[^4]
    • [x] Unit Tests
    • [ ] Integration Tests
    • [ ] Manual Tests

[^1]: It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavor to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. [^2]: Configuration is an important part of many changes. Where applicable please try to document configuration examples. [^3]: A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices. [^4]: Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

conwuegb avatar May 31 '25 01:05 conwuegb