{"id":13822518,"url":"https://github.com/lumeohq/xsd-parser-rs","last_synced_at":"2025-05-16T17:30:57.288Z","repository":{"id":40685661,"uuid":"224442441","full_name":"lumeohq/xsd-parser-rs","owner":"lumeohq","description":"A xsd/wsdl =\u003e rust code generator written in rust","archived":false,"fork":false,"pushed_at":"2024-09-19T14:58:34.000Z","size":1350,"stargazers_count":101,"open_issues_count":45,"forks_count":39,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-11-19T23:37:19.899Z","etag":null,"topics":["onvif","rust","rust-lang","soap","wsdl","xsd"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lumeohq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-27T13:55:29.000Z","updated_at":"2024-11-17T19:15:36.000Z","dependencies_parsed_at":"2024-08-04T08:08:36.427Z","dependency_job_id":"8cbc559f-1b7e-4bdb-a3a9-eca327b03486","html_url":"https://github.com/lumeohq/xsd-parser-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lumeohq%2Fxsd-parser-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lumeohq%2Fxsd-parser-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lumeohq%2Fxsd-parser-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lumeohq%2Fxsd-parser-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lumeohq","download_url":"https://codeload.github.com/lumeohq/xsd-parser-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254576408,"owners_count":22094363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["onvif","rust","rust-lang","soap","wsdl","xsd"],"created_at":"2024-08-04T08:02:03.869Z","updated_at":"2025-05-16T17:30:56.792Z","avatar_url":"https://github.com/lumeohq.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# xsd-parser-rs\nAn xsd/wsdl =\u003e rust code generator written in rust. The main target is for generation of the [ONVIF Specifications](https://www.onvif.org/) but should work for other SOAP/XSDL/WSDL needs.\n\n## Work in Progress\nThis is still a work in progress.  So please feel free to open issues and submit PRs. Please be sure to read and follow our [Code of Conduct](/CODE_OF_CONDUCT.md).\n\n## XSD types mapping\n\nA following mapping used to represent built-in XSD types as rust types:\n\n|XSD               |rust                   |\n|------------------|-----------------------|\n|hexBinary         |String                 |\n|base64Binary      |String                 |\n|boolean           |bool                   |\n|integer           |Integer (1)            |\n|nonNegativeInteger|NonNegativeInteger (1) |\n|positiveInteger   |PositiveInteger (1)    |\n|nonPositiveInteger|NonPositiveInteger (1) |\n|negativeInteger   |NegativeInteger (1)    |\n|long              |i64                    |\n|int               |i32                    |\n|short             |i16                    |\n|byte              |i8                     |\n|unsignedLong      |u64                    |\n|unsignedInt       |u32                    |\n|unsignedShort     |u16                    |\n|unsignedByte      |u8                     |\n|decimal           |Decimal (2)            |\n|double            |f64                    |\n|float             |f64                    |\n|date              |Date (3)               |\n|time              |Time (3)               |\n|dateTime          |DateTime (3)           |\n|dateTimeStamp     |DateTimeStamp (3)      |\n|duration          |Duration (4)           |\n|gDay              |GDay (5)               |\n|gMonth            |GMonth (5)             |\n|gMonthDay         |GMonthDay (5)          |\n|gYear             |GYear (5)              |\n|gYearMonth        |GYearMonth (5)         |\n|string            |String                 |\n|normalizedString  |String                 |\n|token             |String                 |\n|language          |String                 |\n|Name              |String                 |\n|NCName            |String                 |\n|ENTITY            |String                 |\n|ID                |String                 |\n|IDREF             |String                 |\n|NMTOKEN           |String                 |\n|anyURI            |String                 |\n|QName             |String                 |\n|NOTATION          |String                 |\n|ENTITIES          |Vec\\\u003cString\\\u003e          |\n|IDREFS            |Vec\\\u003cString\\\u003e          |\n|NMTOKENS          |Vec\\\u003cString\\\u003e          |\n\nNotes:\n\n(1) we are using our own big integer types, that wrap `num_bigint::BigInt` and `num_bigint::BigUint`\nand provide XML (de)serialization with `yaserde`. You can find `Integer`, `NonNegativeInteger`,\n`PositiveInteger`, `NonPositiveInteger` and `NegativeInteger` in the corresponding files within\n`xsd-types/src/types/`\n\n(2) we are using our own type `Decimal`, which wraps `bigdecimal::BigDecimal` and provides \nXML (de)serialization with `yaserde`. You can find `Decimal` in `xsd-types/src/types/decimal.rs`\n\n(3) we are using our own time types, that wrap types from `chrono` crate and provide\nXML (de)serialization with `yaserde`. You can find `Date`, `Time`, `DateTime` and `DateTimeStamp`\nin the corresponding files within `xsd-types/src/types/`. Since `chrono` has it flaws and does not\nfollow ISO 8601 strictly, we use self-implemented parsing and might replace `chrono` in the future.\nFeel free to suggest an appropriate crate for time handling.\n\n(4) we are using our own type `Duration`, since there is no known implementation\nin rust that supports proper month/years holding and literal representation. You can find\n`Duration` in `xsd-types/src/types/duration.rs`\n\n(5) we are using our own gregorian calendar types, that provide XML (de)serialization with `yaserde`\nfollowing ISO 8601 strictly. You can find `gDay`, `gMonth`, `gMonthDay`, `gYear` and `gYearMonth`\nin the corresponding files within `xsd-types/src/types/`.\n\n## `any` elements handling\n\nThere are cases when schema allows extensions for the certain type.\n\n```xml\n\u003cxs:complexType name=\"MyType\"\u003e\n    \u003cxs:sequence\u003e\n        \u003cxs:element name=\"Parameters\" type=\"xs:string\" /\u003e\n        \u003cxs:any namespace=\"##any\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/\u003e\n    \u003c/xs:sequence\u003e\n    \u003cxs:anyAttribute namespace=\"##any\" processContents=\"lax\"/\u003e\n\u003c/xs:complexType\u003e\n```\n\nIn such cases we don't know in advance what fields must be present in Rust struct so we don't add them to output:\n\n```rust\n#[derive(Default, Clone, PartialEq, Debug, YaSerialize, YaDeserialize)]\n#[yaserde(prefix = \"tns\", namespace = \"tns: http://example.com\")]\npub struct MyType {\n    #[yaserde(prefix = \"tns\", rename = \"Parameters\")]\n    pub parameters: String,\n}\n```\n\nIn this unlucky situation to support extensions user can either:\n- modify the generated code and add extension fields manually\n- modify source XSD and add extension elements there\n\n## License\n\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\n\u003cbr/\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flumeohq%2Fxsd-parser-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flumeohq%2Fxsd-parser-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flumeohq%2Fxsd-parser-rs/lists"}