RUMM-2266 Enable Session Replay models generation #938
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What and why?
📦 This PR fixes 2 problems discovered when running models generation for Session Replay schemas. With this fix, the generator makes successful run on session-replay-mobile-events-format.json and prints Swift code.
This PR doesn't yet:
rum-models-generator
package to include separate generation tracks for RUM and SR.Both elements will be delivered in next PRs.
How?
First, I enhanced JSON schema reader with inferring
type
if it is not explicitly defined. This is the case ofmutation-data-schema.json
which defines following array items without declaringtype: object
:In such case ☝️, we can infer that item is of
type: object
, because it definesproperties
.Alternatively, we could consider updating
mutation-data-schema.json
withtype
information. I don't do it for two reasons:type
is a mandatory field (seems not);Second, there was one generation branch in
oneOf
resolution marked as "not yet supported". In this PR I'm adding support to mixingJSONObject
andJSONOneOf
definitions in a singleoneOf
.Review checklist
Custom CI job configuration (optional)