@govuk-one-login/data-vocab 0.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +258 -0
  2. package/credentials.d.ts +1400 -0
  3. package/package.json +9 -2
package/README.md ADDED
@@ -0,0 +1,258 @@
1
+ # Digital Identity Vocabulary Specification
2
+
3
+ ## About
4
+
5
+ This specification intends to describe a Linked Data vocabulary for asserting Verifiable Credentials related to identity proofing and verification.
6
+
7
+ This repository produces the following artifacts:
8
+
9
+ - [Vocabulary documentation](https://govuk-one-login.github.io/data-vocab/)
10
+ - [JSON Schemas](https://github.com/govuk-one-login/data-vocab/releases)
11
+ - [TypeScript types (npm module)](https://github.com/govuk-one-login/data-vocab/pkgs/npm/data-vocab)
12
+ - [Java data model classes (Maven artifact)](https://github.com/orgs/govuk-one-login/packages?repo_name=data-vocab&ecosystem=maven)
13
+
14
+ Further development could include:
15
+
16
+ - JSON-LD
17
+ - OpenAPI description for our various OAuth providers
18
+
19
+ ## Getting started
20
+
21
+ ### Manually
22
+
23
+ - Install Python for example by [installing pyenv](https://briansunter.com/blog/python-setup-pyenv-poetry/#initial-setup);
24
+ - Install [poetry](https://python-poetry.org/docs/) so that you can install and run this project's Python dependencies;
25
+ - Install Node (and NPM) for example by [installing NVM](https://github.com/nvm-sh/nvm#installing-and-updating);
26
+ - Install some build and test command line tools we require globally (or into your environment, somehow)
27
+
28
+ ```bash
29
+ poetry install
30
+
31
+ npm install
32
+ npm install -g ajv-cli@5.0.0 ajv-formats@2.1.1
33
+ ```
34
+
35
+ > If the above dependencies/versions need to change, please update the [devcontainer configuration](.devcontainer/devcontainer.json) also.
36
+
37
+ If you get an error like `No module named 'packaging'` then you may need to run `pip install packaging`
38
+
39
+ ### Dev Container
40
+
41
+ Open the repo in a development container in vscode, and the pre-requisites will be pre-installed
42
+
43
+ ## Modifying the source LinkML
44
+
45
+ Edit the files in [/v1/linkml-schemas/](./v1/linkml-schemas/)
46
+
47
+ > :exclamation: Class names are all post-fixed with `Class`.
48
+ > This is because otherwise, when generating documentation on MacOS, classes whose names clash with slot names (eg `Name` and `name`) will be lost, see
49
+ > [LinkML Issue 632](https://github.com/linkml/linkml/issues/632).
50
+
51
+ ## Generating JSON Schemas and compiling the documentation site
52
+
53
+ ```
54
+ ./scripts/build
55
+ ```
56
+
57
+ ## Run tests
58
+
59
+ Test the example files against the JSON schemas using an independent JSON-Schema library:
60
+
61
+ ```
62
+ ./scripts/test
63
+ ```
64
+
65
+ ## Run a local server
66
+
67
+ ```
68
+ poetry run mkdocs serve
69
+ ```
70
+
71
+ If the styling appears off, you may need to run the build script first
72
+
73
+ ## Deploy
74
+
75
+ ```
76
+ ./scripts/deploy
77
+ ```
78
+
79
+ ---
80
+
81
+ # Using the TypeScript types
82
+
83
+ Type definition files (`.d.ts`) are published with each tagged version of this repository. You can add these as a dependency in your TypeScript/Node.js project.
84
+
85
+ These are published as [an npm module](https://github.com/govuk-one-login/data-vocab/pkgs/npm/data-vocab) to GitHub Packages.
86
+
87
+ > **Note**
88
+ > Check out the [sample project](https://github.com/govuk-one-login/data-vocab/tree/main/examples/typescript-nodejs) for an example.
89
+
90
+ ## Add the dependency
91
+
92
+ You can add it as a dependency using npm:
93
+
94
+ ```shell
95
+ npm install @govuk-one-login/data-vocab@1.4.2
96
+ ```
97
+
98
+ Or in your `package.json` dependencies:
99
+
100
+ ```json
101
+ "@govuk-one-login/data-vocab": "1.4.2"
102
+ ```
103
+
104
+ > **Note**
105
+ > See [releases](https://github.com/govuk-one-login/data-vocab/releases) for the latest version.
106
+
107
+ ## Setting permissions
108
+
109
+ ### Working locally
110
+
111
+ If you are working locally, ensure you have authenticated to the `@govuk-one-login` npm scope in GitHub Packages:
112
+
113
+ ```shell
114
+ npm login --scope=@govuk-one-login --auth-type=legacy --registry=https://npm.pkg.github.com
115
+ ```
116
+
117
+ > See [Authenticating to GitHub Packages](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages) documentation.
118
+
119
+ ### Using the package in GitHub Actions
120
+
121
+ If you are building your project in a GitHub Actions workflow, grant access to your repository from the [package settings](https://github.com/orgs/govuk-one-login/packages/npm/data-vocab/settings) page.
122
+
123
+ In your workflow file, set the following permission for the GitHub token:
124
+
125
+ ```yaml
126
+ permissions:
127
+ packages: read
128
+ ```
129
+
130
+ In your `setup-node` step, set the registry URL:
131
+
132
+ ```yaml
133
+ registry-url: 'https://npm.pkg.github.com'
134
+ ```
135
+
136
+ <details>
137
+ <summary>Full setup-node step example</summary>
138
+
139
+ Here's an example of the step with the registry configured:
140
+
141
+ ```yaml
142
+ steps:
143
+ - name: Setup node and npm
144
+ uses: actions/setup-node@v4
145
+ with:
146
+ node-version: 22
147
+ cache: npm
148
+ registry-url: 'https://npm.pkg.github.com'
149
+ ```
150
+
151
+ </details>
152
+
153
+ In the step where you run `npm install`, set the `NODE_AUTH_TOKEN` environment variable:
154
+
155
+ ```yaml
156
+ NODE_AUTH_TOKEN: ${{ github.token }}
157
+ ```
158
+
159
+ <details>
160
+ <summary>Full npm install example</summary>
161
+
162
+ Here's an example of the step with the `NODE_AUTH_TOKEN` configured:
163
+
164
+ ```yaml
165
+ - name: Install npm dependencies
166
+ run: 'npm ci --ignore-scripts'
167
+ env:
168
+ NODE_AUTH_TOKEN: ${{ github.token }}
169
+ ```
170
+
171
+ </details>
172
+
173
+ ---
174
+
175
+ # Using the Java dependency
176
+
177
+ Java data model classes are published with each tagged version of this repository. You can add these as a dependency in your Gradle/Maven project.
178
+
179
+ These are published as [a Maven artifact](https://github.com/orgs/govuk-one-login/packages?repo_name=data-vocab&ecosystem=maven) to GitHub Packages.
180
+
181
+ ## Add the dependency
182
+
183
+ ### Gradle
184
+
185
+ Add this to `build.gradle`:
186
+
187
+ ```groovy
188
+ repositories {
189
+ maven {
190
+ url = uri("https://maven.pkg.github.com/govuk-one-login/data-vocab")
191
+ credentials {
192
+ username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
193
+ password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
194
+ }
195
+ }
196
+ }
197
+
198
+ dependencies {
199
+ implementation 'uk.gov.di.model:di-data-model:0.1.0-SNAPSHOT'
200
+ }
201
+ ```
202
+
203
+ > [Learn more](https://docs.github.com/articles/configuring-gradle-for-use-with-github-package-registry/) about consuming the dependency from Gradle.
204
+
205
+ ### Maven
206
+
207
+ Add the repository and server settings to `~/.m2/settings.xml` per [the GitHub instructions](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages).
208
+
209
+ Add this to `pom.xml`:
210
+
211
+ ```xml
212
+ <dependency>
213
+ <groupId>uk.gov.di.model</groupId>
214
+ <artifactId>di-data-model</artifactId>
215
+ <version>0.1.0-SNAPSHOT</version>
216
+ </dependency>
217
+ ```
218
+
219
+ > [Learn more](https://docs.github.com/articles/configuring-apache-maven-for-use-with-github-package-registry/) about consuming the dependency from Maven.
220
+
221
+ ---
222
+
223
+ # Release process
224
+
225
+ To cut a release, you need to:
226
+
227
+ 1. Update the version in the Gradle properties file
228
+ 2. Update the version in the Node.js package.json files
229
+ 3. Commit the changes
230
+ 4. Tag the commit with the version number
231
+
232
+ To automate this process, you can use the `scripts/prep_release.sh` script:
233
+
234
+ ```shell
235
+ ./scripts/prep_release.sh <release type>
236
+ ```
237
+
238
+ Where `<release type>` is one of `major`, `minor`, or `patch` in line with [Semantic Versioning](https://semver.org/).
239
+
240
+ For example:
241
+
242
+ ```shell
243
+ $ ./scripts/prep_release.sh patch
244
+
245
+ New version: 1.7.2
246
+ Commit changes and create tag (y/N)?
247
+ ```
248
+
249
+ Once you have confirmed the version, the script will commit the changes and create a tag for the release.
250
+
251
+ > **Note**
252
+ > You must push the tag and update the `main` branch to trigger the release process.
253
+ >
254
+ > ```shell
255
+ > git push origin main --tags
256
+ > ```
257
+
258
+ On push, the GitHub Actions workflow will build and publish the artifacts to GitHub Packages and the vocab static site.