Skip to content

[native_assets_cli] JSON nest encoding of assets #2090

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 Mar 11, 2025 · 0 comments · Fixed by #2137
Closed

[native_assets_cli] JSON nest encoding of assets #2090

dcharkes opened this issue Mar 11, 2025 · 0 comments · Fixed by #2137
Assignees

Comments

@dcharkes
Copy link
Collaborator

Currently, the asset encoding is that type is a special key in the map and all the other keys are the encoding.

This is a bit smelly, because it means that if someone were to make a type in the encoding it would break.

Also it leads to some weird filtering in maps:

if (key != _typeKey) key: json[key],

@mkustermann suggested we should nest it.

{
  "type": "code_asset",
  "encoding" : {
    "architecture" : "x64"
  }
}
@dcharkes dcharkes added this to the Native Assets v1.0 milestone Mar 11, 2025
auto-submit bot pushed a commit that referenced this issue Mar 17, 2025
…2102)

Bug: #1826

`package:json_syntax_generator` is only reusable if the files are self contained.

_Alternatively, we could make the generator take a config option for a JSON import. However, the downside would be that we would need copy paste the library file to multiple places._

Additionally, this PR cleans up all other uses of the `utils/json.dart` in `package:native_assets_cli`. The only remaining JSON helper is `sortOnKey()` because the asset-extension touches JSON manually and needs to sort the keys. (This could be addressed when addressing #2090.)
@dcharkes dcharkes moved this to In Progress in Native Assets Mar 25, 2025
@dcharkes dcharkes self-assigned this Mar 25, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Native Assets Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant