Skip to content

Commit ecaf947

Browse files
authored
Merge pull request #14344 from obsidiansystems/json-schema-deriving-path
JSON Schema for `DerivedPath`
2 parents 8b7e03f + 8d338c9 commit ecaf947

File tree

9 files changed

+63
-0
lines changed

9 files changed

+63
-0
lines changed

doc/manual/package.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ mkMesonDerivation (finalAttrs: {
3535
../../.version
3636
# For example JSON
3737
../../src/libutil-tests/data/hash
38+
../../src/libstore-tests/data/derived-path
3839
# Too many different types of files to filter for now
3940
../../doc/manual
4041
./.

doc/manual/source/SUMMARY.md.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
- [Hash](protocols/json/hash.md)
121121
- [Store Object Info](protocols/json/store-object-info.md)
122122
- [Derivation](protocols/json/derivation.md)
123+
- [Deriving Path](protocols/json/deriving-path.md)
123124
- [Serving Tarball Flakes](protocols/tarball-fetcher.md)
124125
- [Store Path Specification](protocols/store-path.md)
125126
- [Nix Archive (NAR) Format](protocols/nix-archive.md)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{#include deriving-path-v1-fixed.md}}
2+
3+
## Examples
4+
5+
### Constant
6+
7+
```json
8+
{{#include schema/deriving-path-v1/single_opaque.json}}
9+
```
10+
11+
### Output of static derivation
12+
13+
```json
14+
{{#include schema/deriving-path-v1/single_built.json}}
15+
```
16+
17+
### Output of dynamic derivation
18+
19+
```json
20+
{{#include schema/deriving-path-v1/single_built_built.json}}
21+
```

doc/manual/source/protocols/json/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ json_schema_config = files('json-schema-for-humans-config.yaml')
1111
schemas = [
1212
'hash-v1',
1313
'derivation-v3',
14+
'deriving-path-v1',
1415
]
1516

1617
schema_files = files()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../../src/libstore-tests/data/derived-path
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"$schema": http://json-schema.org/draft-04/schema#
2+
"$id": https://nix.dev/manual/nix/latest/protocols/json/schema/deriving-path-v1.json
3+
title: Deriving Path
4+
description: |
5+
This schema describes the JSON representation of Nix's [Deriving Path](@docroot@/store/derivation/index.md#deriving-path).
6+
oneOf:
7+
- title: Constant
8+
description: |
9+
See [Constant](@docroot@/store/derivation/index.md#deriving-path-constant) deriving path.
10+
type: string
11+
- title: Output
12+
description: |
13+
See [Output](@docroot@/store/derivation/index.md#deriving-path-output) deriving path.
14+
type: object
15+
properties:
16+
drvPath:
17+
"$ref": "#"
18+
description: |
19+
A deriving path to a [Derivation](@docroot@/store/derivation/index.md#store-derivation), whose output is being referred to.
20+
output:
21+
type: string
22+
description: |
23+
The name of an output produced by that derivation (e.g. "out", "doc", etc.).
24+
required:
25+
- drvPath
26+
- output
27+
additionalProperties: false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../src/libstore-tests/data/derived-path

src/json-schema-checks/meson.build

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ schemas = [
5252
# 'output-inputAddressed.json',
5353
# ],
5454
# },
55+
{
56+
'stem' : 'deriving-path',
57+
'schema' : schema_dir / 'deriving-path-v1.yaml',
58+
'files' : [
59+
'single_opaque.json',
60+
'single_built.json',
61+
'single_built_built.json',
62+
],
63+
},
5564
]
5665

5766
# Validate each example against the schema

src/json-schema-checks/package.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ mkMesonDerivation (finalAttrs: {
2222
../../doc/manual/source/protocols/json/schema
2323
../../src/libutil-tests/data/hash
2424
../../src/libstore-tests/data/derivation
25+
../../src/libstore-tests/data/derived-path
2526
./.
2627
];
2728

0 commit comments

Comments
 (0)