You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
allOf inside pull_request would result of generation of type PullRequestClosedPullRequest which is almost the same as normal PullRequest but has one extra field. This creates a problem for consuming those types: let's say you need a field from inside pull_request -- you would have to account for all of the variations of it.
In languages like TS this would be solved by structural subtyping; in rust, while there's nothing like that built-in, perhaps there's a way to adjust behaviour of anyOf to generate some code that would be able to return common parts? e. g. via a generated trait for example. Right now this needs a lot of boilerplate code, for example to extract any pull_request field form PullRequestEvent
The text was updated successfully, but these errors were encountered:
My intention here (that I think is relevant to what you're asking) is to have a From impl for allOf constructions such as this. For example, we'd do something like this:
Consider the following schema:
https://unpkg.com/@octokit/[email protected]/schema.json
it contains a definition:
allOf
insidepull_request
would result of generation of typePullRequestClosedPullRequest
which is almost the same as normalPullRequest
but has one extra field. This creates a problem for consuming those types: let's say you need a field from insidepull_request
-- you would have to account for all of the variations of it.In languages like TS this would be solved by structural subtyping; in rust, while there's nothing like that built-in, perhaps there's a way to adjust behaviour of
anyOf
to generate some code that would be able to return common parts? e. g. via a generated trait for example. Right now this needs a lot of boilerplate code, for example to extract any pull_request field formPullRequestEvent
The text was updated successfully, but these errors were encountered: