{"id":31530224,"url":"https://github.com/frictionlessdata/datapackage-swift","last_synced_at":"2025-10-04T01:19:40.073Z","repository":{"id":63910205,"uuid":"244607407","full_name":"frictionlessdata/datapackage-swift","owner":"frictionlessdata","description":"A Swift library for working with Data Package.","archived":false,"fork":false,"pushed_at":"2022-12-19T07:29:00.000Z","size":46,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-08-29T05:40:06.122Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frictionlessdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-03T10:30:56.000Z","updated_at":"2024-10-17T22:01:15.000Z","dependencies_parsed_at":"2022-11-29T07:14:27.059Z","dependency_job_id":null,"html_url":"https://github.com/frictionlessdata/datapackage-swift","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/frictionlessdata/datapackage-swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frictionlessdata%2Fdatapackage-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frictionlessdata%2Fdatapackage-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frictionlessdata%2Fdatapackage-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frictionlessdata%2Fdatapackage-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frictionlessdata","download_url":"https://codeload.github.com/frictionlessdata/datapackage-swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frictionlessdata%2Fdatapackage-swift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278252425,"owners_count":25956295,"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","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-10-04T01:19:35.412Z","updated_at":"2025-10-04T01:19:40.067Z","avatar_url":"https://github.com/frictionlessdata.png","language":"Swift","readme":"# datapackage-swift\n\n[![Build](https://github.com/frictionlessdata/datapackage-swift/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/frictionlessdata/datapackage-swift/actions/workflows/tests.yml)\n[![Coverage](https://coveralls.io/repos/github/frictionlessdata/datapackage-swift/badge.svg?branch=main)](https://coveralls.io/github/frictionlessdata/datapackage-swift?branch=main)\n[![Codebase](https://img.shields.io/badge/codebase-github-brightgreen)](https://github.com/frictionlessdata/datapackage-swift)\n[![Support](https://img.shields.io/badge/support-discord-brightgreen)](https://discordapp.com/invite/Sewv6av)\n\nA Swift library for working with [Data Packages](https://frictionlessdata.io/specs/data-package/). It also includes a profile for [Tabular Data Package](https://specs.frictionlessdata.io/tabular-data-package/) in conjunction with the corresponding [Table Schema](https://github.com/frictionlessdata/tableschema-swift) library.\n\n## Requirements\n * Source compatibility with Swift 4.2\n * Target platforms\n    * Apple platforms, specifically iOS and macOS\n       * Full functionality in iOS \u003e= 10 and macOS \u003e= 10.12\n    * Linux, limited by feature availability in `swift-corelibs-foundation`\n * Apple's `Foundation` framework is the only dependency\n\n## Implementation Status\nThis library supports the following features and profiles. There is a testing suite to keep what should be working in check. Contributions are welcome.\n\nNote that the implementation of Table Schema for the Tabular Data Package Profile is incomplete. Field types that are unsupported will not be transformed resulting in potential data loss on those unsupported types.\n\n### High-Level Status\n\n| Feature                                 | Status                       |\n|:----------------------------------------|:-----------------------------|\n| Read/Write Data Package JSON descriptor | Available                    |\n| Tabular Data Package profile            | Available                    |\n| Validation                              | Available                    |\n| Validation against JSON Schema          | Missing                      |\n| Retrieving Remote Resources             | Missing, consumer may handle |\n| Verification                            | Mostly Available             |\n| Strict Mode                             | Partial, through log levels  |\n| Schema Inference                        | Missing                      |\n| Zipping                                 | Missing                      |\n| Additional/Custom Properties            | Available                    |\n| Extension through Profiles              | Available                    |\n\nThis is an idiomatic Swift implementation of Data Package and Tabular Data Package. It initially implemented a subset of features for use to serialize (and deserialize) a database into a human-usable format. It has since been expanded for more general use. Although this implementation provides access to all attributes in the spec, some features have been deprioritized, notably anything involving networking and schema verification.\n\nThe general strategy is to implement features only as needed.\n\n### Data Package Profile Status\n\n| Feature                      | Status    |\n|:-----------------------------|:----------|\n| Additional/Custom Properties | Available |\n\n| Property     | Status                                    |\n|:-------------|:------------------------------------------|\n| Name         | Available, no validation                  |\n| Id           | Available                                 |\n| Licenses     | Available                                 |\n| Title        | Available                                 |\n| Description  | Available, no validation                  |\n| Homepage     | Available                                 |\n| Version      | Available, no semantic version validation |\n| Sources      | Available                                 |\n| Contributors | Available                                 |\n| Keywords     | Available                                 |\n| Image        | Available                                 |\n| Created      | Available\\*                               |\n\n\\* Only available on Apple products (iOS \u003e= 10 and macOS \u003e= 10.12) due to an incomplete Linux implementation in `swift-corelibs-foundation`. Fractional seconds currently unsupported.\n\n#### Data Resource Profile Status\n\n| Feature                      | Status                  |\n|:-----------------------------|:------------------------|\n| Locally Bundled Resources    | Available               |\n| Retrieving Remote Resources  | Consumer must handle    |\n| Inline Data                  | Consumer must interpret |\n| Multiple Paths per Resources | Consumer must handle    |\n\n| Property    | Status                                  |\n|:------------|:----------------------------------------|\n| Path        | Available, no validation                |\n| Data        | Available, but consumer may interpret   |\n| Name        | Available, no validation                |\n| Title       | Available                               |\n| Description | Available                               |\n| Format      | Available                               |\n| Mediatype   | Available                               |\n| Encoding    | Available                               |\n| Bytes       | Available, but consumer should validate |\n| Hash        | Available, but consumer should validate |\n| Sources     | Available                               |\n| Licenses    | Available                               |\n| Schema      | Available, but consumer may interpret   |\n\n### Tabular Data Package Profile Status\n\n| Feature     | Status                                   |\n|:------------|:-----------------------------------------|\n| CSV Support | Available, requires external CSV library |\n\n#### Tabular Data Resource Profile Status\n\n| Feature                      | Status                  |\n|:-----------------------------|:------------------------|\n| Table Schema                 | Available               |\n| CSV Dialect                  | Available               |\n| Locally Bundled Resources    | Available               |\n| Retrieving Remote Resources  | Consumer must handle    |\n| Inline Data                  | Consumer must interpret |\n| Multiple Paths per Resources | Consumer must handle    |\n\n##### Table Schema Status\nSee [Table Schema](https://github.com/frictionlessdata/tableschema-swift).\n\n## Command Line Interface\nA simple CLI tool is included which uses this library to display package validation warnings and errors and optionally re-export.\n\n```bash\nmake\nmake install\ndatapackage-swift path/to/package\n```\n\n## Integrating into Your Project\n\n### Swift Package Manager\nThis project is set up using [Swift Package Manager](https://swift.org/package-manager/). Ideally add it to your project's SPM dependencies or use Xcode's integrated Swift Package Manager. Alternatively, generate your own Xcode `.xcodeproj` to integrate with your build system using:\n\n```bash\nswift package generate-xcodeproj --xcconfig-overrides ./Configuration.xcconfig\n```\n\n## Example Usage\n\n### Instantiation\nA package can be instantiated from a JSON descriptor:\n\n```swift\nlet registry = Registry(default: Package.self)\nregistry.add(profile: Package.self)\nregistry.add(profile: TabularDataPackage.self)\n\nvar importURL = URL(fileURLWithPath: \"./\")\nimportURL.appendPathComponent(\"2017-12-14\", isDirectory: true)\n\nvar log = Log()\n\nguard let package = Package.package(url: importURL, registry: registry, log: \u0026log) else {\n    // Error\n}\n```\n\nOr it may be instantiated directly:\n\n```swift\nlet package = Package()\n```\n\n### Serialization\n\n```swift\nvar exportURL = URL(fileURLWithPath: \"./\")\nexportURL.appendPathComponent(\"2017-12-15\", isDirectory: true)\n\nguard package.save(to: exportURL) else {\n    // Error\n}\n```\n\n## Understanding the Library\n\n### Model Checking (Validation and Verification)\nThe library makes a distinction between validation and verification: Validation corresponds to the validity of the model at instantiation when it is deserialized from a JSON descriptor. Whereas verification corresponds to validity of the model at some point in time after instantiation.\n\nThe distinction is helpful because the specification imposes some constraints on a model that may not all be resolvable at compile time. Examples include whether the value of a required property is inappropriately formatted, or a property whose existence is conditional on another property. Additionally, the models should allow for transitioning as the model is updated to a new state. As such, it is necessary to check for validity at instantiation and through a model verification step while using the model.\n\nTwo methods are used for model checking. First, some initializers are failable. Second, a log is exposed that denotes errors and warnings about the model.\n\n```swift\nvar log = Log()\n\nlet package = Package.package(url: importURL, registry: registry, log: \u0026log)\nlet package?.verify(log: \u0026log)\n\nfor item in log.items {\n    print(item.message)\n}\n```\n\nLogs are leveled by severity with errors resulting in models not being instantiated. An error corresponds to a `MUST`, `MUST NOT`, `REQUIRED`, `SHALL`, or `SHALL NOT` in the specification. A warning corresponds to `SHOULD`, `SHOULD NOT`, or `RECOMMENDED`.\n\n### Model Representation\nRather than a model instance maintaining an underlying JSON descriptor that is modified when accessing various properties, this library decodes the JSON descriptor to model objects. This has implications for serialization where exporting of the model is not stable: Unchanged properties may be altered, and the ordering and formatting of properties may not be preserved.\n\n### A Word on Swift Libraries\nSwift 5 is source compatible with Swift 4 and the history has been that each new Swift version is source compatible with the last. Although ABI stability, module stability, and library evolution support are ongoing issues that address compatibility concerns over authoring and consumption of libraries, in practice binary compatibility is less of a concern than source code compatibility since code for this library is available. Additionally, Swift 5's ABI stability is only available on Apple's platforms -- other platforms like Linux are to implement it separately.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrictionlessdata%2Fdatapackage-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrictionlessdata%2Fdatapackage-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrictionlessdata%2Fdatapackage-swift/lists"}