diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f628bd3..59a1932 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,6 +19,8 @@ jobs: with: submodules: recursive - uses: dtolnay/rust-toolchain@1.78.0 + - name: get-cmake + uses: lukka/get-cmake@latest - uses: jetli/wasm-pack-action@v0.4.0 with: version: "v0.12.1" @@ -30,11 +32,14 @@ jobs: rustup component add clippy cargo clippy --no-deps - name: Build - run: cargo build --release + run: cargo build --features schema,trace --release - name: Test Rust - run: cargo test + run: cargo test --features schema,trace - name: Build WASM - run: wasm-pack build --release --target nodejs --reference-types --weak-refs + run: | + wasm-pack build --release --target nodejs --reference-types --weak-refs --features wasm + cp target/schemas/out/980faa7cf81d51eab3f26de770ae345d.xsdb pkg/xwasser-v050.xsdb.bin + cp package.tmp.json pkg/package.json - name: Test WASM run: | pnpm i diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 713b5c3..5afe3eb 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -20,9 +20,12 @@ jobs: with: submodules: recursive - uses: dtolnay/rust-toolchain@1.78.0 + - name: get-cmake + uses: lukka/get-cmake@latest - name: Publish to crates.io. run: | - cargo publish --token ${CRATES_TOKEN} + cargo publish --token ${CRATES_TOKEN} -p xoev-xwasser-derive + cargo publish --token ${CRATES_TOKEN} -p xoev-xwasser env: CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} - uses: actions/setup-node@v4 diff --git a/Cargo.lock b/Cargo.lock index 4d6d376..d24de90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -993,6 +993,8 @@ dependencies = [ [[package]] name = "raxb" version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a43a719ef1c9b5051bc5223603e0c422cdec0c73e885d53262dc2ba0bf5769ce" dependencies = [ "quick-xml", "raxb-derive", @@ -1003,6 +1005,8 @@ dependencies = [ [[package]] name = "raxb-derive" version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e20ef368dab8c97216271bd20a125492cbf984054c352f5e9467bdeb8b93f4f" dependencies = [ "darling", "heck", @@ -1016,6 +1020,8 @@ dependencies = [ [[package]] name = "raxb-libxml2-sys" version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2867d8264004ead64778cc190f22066f009277ffd075ca58c17e135472716295" dependencies = [ "bindgen", "cmake", @@ -1024,6 +1030,8 @@ dependencies = [ [[package]] name = "raxb-validate" version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc59c99c5fcb4bfbed8e9fdf6584a50dce233a7259f365ed20eec872278429da" dependencies = [ "byteorder", "libc", @@ -1040,6 +1048,8 @@ dependencies = [ [[package]] name = "raxb-xmlschema" version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0886668f5fc3a8e58c8925be867df2ff36a8f1ac957f1aeb637cd2d969549d14" dependencies = [ "byteorder", "lz4_flex", @@ -1052,6 +1062,8 @@ dependencies = [ [[package]] name = "raxb-xmlschema-build" version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add49d3d705b359f64326e32972c89aa27769a2e0e26e6611d1850751a42642d" dependencies = [ "byteorder", "raxb", @@ -2150,7 +2162,7 @@ dependencies = [ [[package]] name = "xoev-xwasser" -version = "0.2.3+0.5.0" +version = "0.3.0+0.5.0" dependencies = [ "anyhow", "raxb", @@ -2163,12 +2175,12 @@ dependencies = [ "test-log", "tsify", "wasm-bindgen", - "xoev-xwasser-derive-rs", + "xoev-xwasser-derive", ] [[package]] -name = "xoev-xwasser-derive-rs" -version = "0.2.3+0.5.0" +name = "xoev-xwasser-derive" +version = "0.3.0+0.5.0" dependencies = [ "darling", "heck", diff --git a/Cargo.toml b/Cargo.toml index bc63c36..51976d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*"] [workspace.package] edition = "2021" -version = "0.2.3+0.5.0" +version = "0.3.0+0.5.0" description = """ "XOEV XWasser XML Standard" """ @@ -16,7 +16,16 @@ categories = [] keywords = [] [workspace.dependencies] -xoev-xwasser-derive-rs = { version = "0.2.3", path = "crates/derive" } +anyhow = "1" +xoev-xwasser-derive = { version = "0.3.0", path = "crates/derive" } +raxb = "0.4.1" +raxb-validate = "0.4.1" +raxb-xmlschema = "0.4.1" +raxb-xmlschema-build = "0.4.1" +# raxb = { path = "../raxb/crates/raxb" } +# raxb-validate = { path = "../raxb/crates/raxb-validate"} +# raxb-xmlschema = { path = "../raxb/crates/raxb-xmlschema"} +# raxb-xmlschema-build = { path = "../raxb/crates/raxb-xmlschema-build"} [package] name = "xoev-xwasser" @@ -45,25 +54,24 @@ schema = [ ] [dependencies] - -xoev-xwasser-derive-rs.workspace = true +xoev-xwasser-derive.workspace = true anyhow = { version = "1", optional = true } rust-embed = { version = "8.5.0", optional = true } -raxb = { path = "../raxb/crates/raxb", features = ["trace"] } -raxb-validate = { path = "../raxb/crates/raxb-validate", optional = true } -raxb-xmlschema = { path = "../raxb/crates/raxb-xmlschema", optional = true } -serde = { version = "1.0.203", features = ["derive"] } +raxb = { workspace = true, features = ["trace"] } +raxb-validate = { workspace = true, optional = true } +raxb-xmlschema = { workspace = true, optional = true } wasm-bindgen = { version = "0.2.84", optional = true } tsify = { version = "0.4.5", features = ["js"], optional = true } +serde = { version = "1.0.203", features = ["derive"] } [build-dependencies] -raxb-xmlschema-build = { path = "../raxb/crates/raxb-xmlschema-build" } -anyhow = "1" +anyhow.workspace = true +raxb-xmlschema-build.workspace = true [dev-dependencies] -raxb-xmlschema-build = { path = "../raxb/crates/raxb-xmlschema-build" } +anyhow.workspace = true +raxb-xmlschema-build.workspace = true serde_json = "1" -anyhow = "1" test-log = { version = "0.2.16", features = ["trace", "color"] } [profile.release] diff --git a/build.sh b/build.sh index f435191..505e762 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash - +cargo test --features schema,trace wasm-pack build --release --target nodejs --reference-types --weak-refs --features wasm --no-default-features cp target/schemas/out/980faa7cf81d51eab3f26de770ae345d.xsdb pkg/xwasser-v050.xsdb.bin cp package.tmp.json pkg/package.json \ No newline at end of file diff --git a/crates/derive/Cargo.toml b/crates/derive/Cargo.toml index 40be814..4351bd9 100644 --- a/crates/derive/Cargo.toml +++ b/crates/derive/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "xoev-xwasser-derive-rs" +name = "xoev-xwasser-derive" edition.workspace = true version.workspace = true description.workspace = true diff --git a/package.json b/package.json index 1644783..317c195 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xoev-xwasser", - "version": "1.0.0", + "version": "0.3.0", "description": "", "main": "index.js", "scripts": { diff --git a/package.tmp.json b/package.tmp.json index c85e96d..f8563bf 100644 --- a/package.tmp.json +++ b/package.tmp.json @@ -4,7 +4,7 @@ "H & D GmbH Open Source " ], "description": "\"XOEV XWasser XML Standard\"\n", - "version": "0.2.3+0.5.0", + "version": "0.3.0+0.5.0", "license": "MIT", "repository": { "type": "git", diff --git a/src/model/codes.rs b/src/model/codes.rs index a083525..de512e3 100644 --- a/src/model/codes.rs +++ b/src/model/codes.rs @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize}; #[cfg(feature = "wasm")] use tsify::Tsify; -use xoev_xwasser_derive_rs::xoev_xwasser_code; +use xoev_xwasser_derive::xoev_xwasser_code; use raxb::de::XmlDeserializeError; use std::str::FromStr; @@ -52,9 +52,9 @@ pub struct CodeBehoerdenkennungType { #[xml(name = b"code", ty = "child")] pub code: String, #[xml(name = b"name", ty = "child")] - pub name: Option, + pub name: Option, #[xml(name = b"listURI", ty = "attr")] - pub list_uri: String, + pub list_uri: String, #[xml(name = b"listVersionID", ty = "attr")] pub list_version_id: String, } diff --git a/tests/quality_report_minimal.json b/tests/quality_report_minimal.json index 4056ffd..0a4947c 100644 --- a/tests/quality_report_minimal.json +++ b/tests/quality_report_minimal.json @@ -66,9 +66,7 @@ "zugelassene_untersuchungsstelle_id": "ID753d97bc-4262-45e8-8c1f-cb7b6ab7864a", "name_zugelassene_untersuchungsstelle": { "code": "09010", - "name": "", - "_list_uri": null, - "_list_version_id": null + "name": "" }, "pruefgebiete_untersuchungen_phys_chem": true, "pruefgebiete_untersuchungen_mikrobio": true, @@ -82,9 +80,7 @@ "untersuchungsverfahren": [ { "code": "1010", - "name": "untersuchungsverfahren", - "_list_uri": null, - "_list_version_id": null + "name": "untersuchungsverfahren" } ], "ergaenzung_zum_untersuchungsverfahren": "ergaenzung_zum_untersuchungsverfahren", @@ -94,9 +90,7 @@ }, "parameterauspraegung": { "code": "1210", - "name": "parameterauspraegung", - "_list_uri": null, - "_list_version_id": null + "name": "parameterauspraegung" }, "parameter_durch_betreiber_untersucht": true, "wurde_der_parameter_korrigiert": null, @@ -109,9 +103,7 @@ "shapth_parameter_nummer": [], "bewertung_untersuchungswert": { "code": "1010", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "parameterauffaelligkeit": null, "messunsicherheit_untersuchungswert_absolut": null, @@ -124,16 +116,12 @@ "anlass_der_untersuchung": [ { "code": "1010", - "name": "name", - "_list_uri": null, - "_list_version_id": null + "name": "name" } ], "medium": { "code": "1010", - "name": "medium", - "_list_uri": null, - "_list_version_id": null + "name": "medium" }, "akkreditierte_durchfuehrung_der_probennahme": true, "ergaenzung_zum_medium": "Wasser", @@ -141,22 +129,16 @@ "probennahmeverfahren": [ { "code": "1010", - "name": "probennahmeverfahren", - "_list_uri": null, - "_list_version_id": null + "name": "probennahmeverfahren" } ], "probenentnahmegeraet": { "code": "1010", - "name": "probenentnahmegeraet", - "_list_uri": null, - "_list_version_id": null + "name": "probenentnahmegeraet" }, "probengefaess": { "code": "1010", - "name": "probengefaess", - "_list_uri": null, - "_list_version_id": null + "name": "probengefaess" }, "ergaenzende_informationen_zu_probenentnahmegeraet": "", "desinfektion_probenentnahmegeraet_durchgefuehrt": true, @@ -173,9 +155,7 @@ "abschluss_analytik": "2024-05-27T10:02:00", "konformitaetsbewertung_der_probe": { "code": "1010", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "berichtspflichtig": true, "von_probennehmer_vergebene_probe_id": "123456789", @@ -193,17 +173,13 @@ "name_probennahmestelle": "wasserloch um die ecke", "art_probennahmestelle": { "code": "1010", - "name": "wasserloch", - "_list_uri": null, - "_list_version_id": null + "name": "wasserloch" }, "stockwerk_probennahmestelle": 1, "medium_an_der_probennahmestelle": [ { "code": "1010", - "name": "medium probennahmestelle", - "_list_uri": null, - "_list_version_id": null + "name": "medium probennahmestelle" } ], "desinfektion_und_aufbereitung_des_wassers": [ @@ -219,9 +195,7 @@ ], "name_beauftragte_untersuchungsstelle": { "code": "09010", - "name": "name", - "_list_uri": null, - "_list_version_id": null + "name": "name" }, "probennehmer": [ { @@ -311,9 +285,7 @@ "titel": "Minimaler Prüfbericht", "gesamtbewertung": { "code": "1010", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "auffaelligkeiten": [ "" @@ -368,9 +340,7 @@ "sw_version": "1", "sprache_pruefbericht": { "code": "1234", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "rechtlicher_disclaimer": "DUMMY", "zeitpunkt_uebermittlung_an_shapth": "2024-12-21T00:00:12", @@ -379,9 +349,7 @@ "auftraggeber_id": "DUMMY", "auftraggeberart": { "code": "1010", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "auftraggeber": { "t": "NatuerlichePerson", @@ -438,9 +406,7 @@ ], "laenderkuerzel": { "code": "DEAA", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "kommentar": null } @@ -493,9 +459,7 @@ "zugelassene_untersuchungsstelle_id": "abcdef", "name_zugelassene_untersuchungsstelle": { "code": "09010", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "pruefgebiete_untersuchungen_phys_chem": null, "pruefgebiete_untersuchungen_mikrobio": null, @@ -519,9 +483,7 @@ "typ": [ { "code": "1312", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null } ], "staat": { @@ -551,9 +513,7 @@ { "dokument_typ": { "code": "1010", - "name": null, - "_list_uri": null, - "_list_version_id": null + "name": null }, "name": "Anlage 1", "aktuelle_version": null,