P3.2: manifest model + std.json parse + validate
Define the v0 publish manifest, parse it via std.json into a typed
struct, and validate it.
- src/manifest/manifest.sx: typed Manifest { app, version, channel,
artifacts: List(ManifestArtifact) } + ManifestArtifact { platform,
path, filename, content_type, metadata }. parse_manifest walks the
std.json Value tree into the struct, surfacing every malformed/
missing/wrong-type field as a distinct typed ManifestErr (BadJson,
WrongType, MissingField, UnknownPlatform, MissingArtifact, Io) — never
a silent default. Reuses P2.1 parse_platform for the platform id.
validate_manifest checks each artifact path exists on disk (fs.exists),
resolved relative to the manifest's directory. Strings are copied into
the caller's allocator (long-lived-container rule).
- examples/dist.json: representative valid manifest (android_apk + ios).
- examples/fixtures/: tiny stand-in artifact byte files referenced by it.
- tests/manifest_parse.sx: parses dist.json and asserts fields; asserts
the three failure classes surface distinct typed errors.
This commit is contained in:
18
examples/dist.json
Normal file
18
examples/dist.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"app": "acme-app",
|
||||
"version": "1.2.3",
|
||||
"channel": "stable",
|
||||
"artifacts": [
|
||||
{
|
||||
"platform": "android_apk",
|
||||
"path": "fixtures/acme-1.2.3-android.apk",
|
||||
"filename": "acme.apk",
|
||||
"content_type": "application/vnd.android.package-archive",
|
||||
"metadata": "{\"min_sdk\":21}"
|
||||
},
|
||||
{
|
||||
"platform": "ios",
|
||||
"path": "fixtures/acme-1.2.3-ios.ipa"
|
||||
}
|
||||
]
|
||||
}
|
||||
1
examples/fixtures/acme-1.2.3-android.apk
Normal file
1
examples/fixtures/acme-1.2.3-android.apk
Normal file
@@ -0,0 +1 @@
|
||||
APK0
|
||||
1
examples/fixtures/acme-1.2.3-ios.ipa
Normal file
1
examples/fixtures/acme-1.2.3-ios.ipa
Normal file
@@ -0,0 +1 @@
|
||||
IPA0
|
||||
Reference in New Issue
Block a user