router icon indicating copy to clipboard operation
router copied to clipboard

chore: Update jsonschema usage

Open Stranger6667 opened this issue 11 months ago • 7 comments

Hey!

This PR updates the jsonschema crate and applies its newer APIs.

Stranger6667 avatar Jan 01 '25 08:01 Stranger6667

@Stranger6667: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

apollo-cla avatar Jan 01 '25 08:01 apollo-cla

✅ Docs Preview Ready

No new or changed pages found.

svc-apollo-docs avatar Jan 01 '25 08:01 svc-apollo-docs

That's awesome, thank you!

It looks like some of our generated definitions have naming that isn't allowed in a uri-reference anymore (things like #/definitions/apollo_router::Extendable<RouterStage>).

Does jsonschema support URL-encoded references? Should it work if we produced something like this instead?

{
  "definitions": { "apollo_router::Extendable<RouterStage>": { /* omitted */ } }
}
// elsewhere...
{
  "$ref": "#/definitions/apollo_router%3A%3AExtendable%3CRouterStage%3E"
}

goto-bus-stop avatar Jan 03 '25 16:01 goto-bus-stop

@goto-bus-stop

I think it should support them, yep :) I haven't tried it myself, though

Is there a test failure because of this?

Stranger6667 avatar Jan 03 '25 16:01 Stranger6667

Yeah, there's a failure because the schema generated by schemars uses ,: <> characters in definitions and references. It seems that some of those characters were accepted in uri references by the old version of jsonschema we have in use at the moment, but not in the new version. Don't worry if that's not something you want to look into, I've put it on my list so I'll take a look at patching it up on our end soon

goto-bus-stop avatar Jan 07 '25 15:01 goto-bus-stop

@Stranger6667 Is this something you think you'll get a chance to look at, or do you think it's better for @goto-bus-stop to take a look at some point?

abernix avatar May 06 '25 09:05 abernix

@abernix I don't have the bandwidth this week, but I can take a look a bit later

Stranger6667 avatar May 06 '25 09:05 Stranger6667

I'll rebase this after https://github.com/apollographql/router/pull/7893 lands.

goto-bus-stop avatar Jul 16 '25 09:07 goto-bus-stop