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

Adds skeleton for ISL Writer #289

Merged
merged 2 commits into from
Oct 3, 2023
Merged

Conversation

popematt
Copy link
Contributor

Issue #, if available:

None

Description of changes:

This is the start of a writer for the Ion Schema model. It includes interfaces for a schema writer, type writer, constraint writers, and implementations of HeaderWriter and FooterWriter.

There's also a little bugfix in IonSchemaResult.

Related PRs in ion-schema, ion-schema-tests, ion-schema-schemas:

None

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Attention: 22 lines in your changes are missing coverage. Please review.

Files Coverage Δ
...n/com/amazon/ionschema/model/UserReservedFields.kt 100.00% <100.00%> (ø)
...m/amazon/ionschema/writer/internal/FooterWriter.kt 100.00% <100.00%> (ø)
...otlin/com/amazon/ionschema/util/IonSchemaResult.kt 75.00% <0.00%> (ø)
...com/amazon/ionschema/writer/internal/TypeWriter.kt 0.00% <0.00%> (ø)
...ma/writer/internal/constraints/ConstraintWriter.kt 0.00% <0.00%> (ø)
...m/amazon/ionschema/writer/internal/HeaderWriter.kt 87.17% <87.17%> (ø)
...otlin/com/amazon/ionschema/writer/internal/util.kt 41.66% <41.66%> (ø)

📢 Thoughts on this report? Let us know!.

fun writeVariablyOccurringTypeArg(ionWriter: IonWriter, varTypeArg: VariablyOccurringTypeArgument, elideOccursValue: DiscreteIntRange)

/**
* Writes a [TypeArguments] to the given [IonWriter].
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Writes a [TypeArguments] to the given [IonWriter].
* Writes a [TypeArgument]s to the given [IonWriter].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a type alias called TypeArguments so this is correct, despite how it looks.

import com.amazon.ionschema.model.VariablyOccurringTypeArgument

@ExperimentalIonSchemaModel
internal interface TypeWriter {
Copy link
Contributor

Choose a reason for hiding this comment

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

(Question) This interface contains both type argument and type definition write methods. I am not sure how these methods will be used though. If you can provide an example that would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The schema writer will call the type definition method to write top-level types in a schema document. Constraint writers can call the type argument method if they have a type argument.

They could be in separate interfaces, because they are called from mutually exclusive locations, but since it's an internal interface, I don't think it's a big deal whether they're together or separate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. It wouldn't matter for an internal interface but since this PR doesn't add any usage of this interface, I was just curious how this is intended to be used.
IMO, it might be worth adding interface definition with at least one place where its implemented or an example/summary of how the interface definition will be used in the PR description.

@popematt popematt merged commit f9042cb into amazon-ion:master Oct 3, 2023
3 of 5 checks passed
@popematt popematt deleted the writer-part-1 branch June 13, 2024 22:31
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