Skip to content

[native_assets_cli] Document the protocol #95

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

Closed
dcharkes opened this issue Jul 19, 2023 · 3 comments
Closed

[native_assets_cli] Document the protocol #95

dcharkes opened this issue Jul 19, 2023 · 3 comments
Assignees
Labels
P3 A lower priority bug or feature request package:hooks type-documentation A request to add or improve documentation

Comments

@dcharkes
Copy link
Collaborator

Currently, the protocol between the Dart (and Flutter) SDK and packages' build.dart is specified by its implementation in package:native_assets_cli. This package also provides a way to parse and unparse the protocol.

@jonasfj mentioned it could be that the community likes to reimplement the protocol in another package. For this, we would need to specify the protocol (in a markdown file for example).

@dcharkes dcharkes added type-documentation A request to add or improve documentation P3 A lower priority bug or feature request package:hooks labels Jul 19, 2023
@jonasfj
Copy link
Member

jonasfj commented Jul 19, 2023

It also makes it easier to track if changes are breaking or not, and forces you to be intentional about what the Dart SDK requires, and what is an implementation detail added for easy debugging.

@dcharkes
Copy link
Collaborator Author

Most probably, we'd want to use the JSON schema for documenting the protocol.

We'd have multiple schemas:

  • input for build hooks
  • input for link hooks
  • output for build hooks
  • output for link hooks
  • (there is currently no config/input for data assets)
  • input for code code assets
  • output for data assets
  • output for code assets

With schema evolution / breaking changes (#93) we'd like to

  1. be able to mark fields as deprecated, which is possible with https://json-schema.org/draft/2019-09/json-schema-validation#rfc.section.9.3
  2. be able to document semantic changes to fields. Maybe we'd do so in the description field.

(For FFIgen we have a schema generator for the config, we should consider having something similar. Then we'd probably want to generate also the Dart classes that do the JSON parsing and instead of operating on the JSON operate on the serializable Dart classes in the implementation. #1826)

@dcharkes
Copy link
Collaborator Author

After #2116, the protocol is fully documented in schemas.

We haven't added descriptions to the schemas so far. We could do so. However, the schemas are close enough to the Dart API that I think the documentation can be inferred from that.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Native Assets Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 A lower priority bug or feature request package:hooks type-documentation A request to add or improve documentation
Projects
Status: Done
Development

No branches or pull requests

2 participants