mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
Merge pull request #14344 from obsidiansystems/json-schema-deriving-path
JSON Schema for `DerivedPath`
This commit is contained in:
commit
ecaf9470b9
9 changed files with 63 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ mkMesonDerivation (finalAttrs: {
|
||||||
../../.version
|
../../.version
|
||||||
# For example JSON
|
# For example JSON
|
||||||
../../src/libutil-tests/data/hash
|
../../src/libutil-tests/data/hash
|
||||||
|
../../src/libstore-tests/data/derived-path
|
||||||
# Too many different types of files to filter for now
|
# Too many different types of files to filter for now
|
||||||
../../doc/manual
|
../../doc/manual
|
||||||
./.
|
./.
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@
|
||||||
- [Hash](protocols/json/hash.md)
|
- [Hash](protocols/json/hash.md)
|
||||||
- [Store Object Info](protocols/json/store-object-info.md)
|
- [Store Object Info](protocols/json/store-object-info.md)
|
||||||
- [Derivation](protocols/json/derivation.md)
|
- [Derivation](protocols/json/derivation.md)
|
||||||
|
- [Deriving Path](protocols/json/deriving-path.md)
|
||||||
- [Serving Tarball Flakes](protocols/tarball-fetcher.md)
|
- [Serving Tarball Flakes](protocols/tarball-fetcher.md)
|
||||||
- [Store Path Specification](protocols/store-path.md)
|
- [Store Path Specification](protocols/store-path.md)
|
||||||
- [Nix Archive (NAR) Format](protocols/nix-archive.md)
|
- [Nix Archive (NAR) Format](protocols/nix-archive.md)
|
||||||
|
|
|
||||||
21
doc/manual/source/protocols/json/deriving-path.md
Normal file
21
doc/manual/source/protocols/json/deriving-path.md
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{{#include deriving-path-v1-fixed.md}}
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Constant
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include schema/deriving-path-v1/single_opaque.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Output of static derivation
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include schema/deriving-path-v1/single_built.json}}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Output of dynamic derivation
|
||||||
|
|
||||||
|
```json
|
||||||
|
{{#include schema/deriving-path-v1/single_built_built.json}}
|
||||||
|
```
|
||||||
|
|
@ -11,6 +11,7 @@ json_schema_config = files('json-schema-for-humans-config.yaml')
|
||||||
schemas = [
|
schemas = [
|
||||||
'hash-v1',
|
'hash-v1',
|
||||||
'derivation-v3',
|
'derivation-v3',
|
||||||
|
'deriving-path-v1',
|
||||||
]
|
]
|
||||||
|
|
||||||
schema_files = files()
|
schema_files = files()
|
||||||
|
|
|
||||||
1
doc/manual/source/protocols/json/schema/deriving-path-v1
Symbolic link
1
doc/manual/source/protocols/json/schema/deriving-path-v1
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../../../../../src/libstore-tests/data/derived-path
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
"$schema": http://json-schema.org/draft-04/schema#
|
||||||
|
"$id": https://nix.dev/manual/nix/latest/protocols/json/schema/deriving-path-v1.json
|
||||||
|
title: Deriving Path
|
||||||
|
description: |
|
||||||
|
This schema describes the JSON representation of Nix's [Deriving Path](@docroot@/store/derivation/index.md#deriving-path).
|
||||||
|
oneOf:
|
||||||
|
- title: Constant
|
||||||
|
description: |
|
||||||
|
See [Constant](@docroot@/store/derivation/index.md#deriving-path-constant) deriving path.
|
||||||
|
type: string
|
||||||
|
- title: Output
|
||||||
|
description: |
|
||||||
|
See [Output](@docroot@/store/derivation/index.md#deriving-path-output) deriving path.
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
drvPath:
|
||||||
|
"$ref": "#"
|
||||||
|
description: |
|
||||||
|
A deriving path to a [Derivation](@docroot@/store/derivation/index.md#store-derivation), whose output is being referred to.
|
||||||
|
output:
|
||||||
|
type: string
|
||||||
|
description: |
|
||||||
|
The name of an output produced by that derivation (e.g. "out", "doc", etc.).
|
||||||
|
required:
|
||||||
|
- drvPath
|
||||||
|
- output
|
||||||
|
additionalProperties: false
|
||||||
1
src/json-schema-checks/deriving-path
Symbolic link
1
src/json-schema-checks/deriving-path
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../src/libstore-tests/data/derived-path
|
||||||
|
|
@ -52,6 +52,15 @@ schemas = [
|
||||||
# 'output-inputAddressed.json',
|
# 'output-inputAddressed.json',
|
||||||
# ],
|
# ],
|
||||||
# },
|
# },
|
||||||
|
{
|
||||||
|
'stem' : 'deriving-path',
|
||||||
|
'schema' : schema_dir / 'deriving-path-v1.yaml',
|
||||||
|
'files' : [
|
||||||
|
'single_opaque.json',
|
||||||
|
'single_built.json',
|
||||||
|
'single_built_built.json',
|
||||||
|
],
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
# Validate each example against the schema
|
# Validate each example against the schema
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ mkMesonDerivation (finalAttrs: {
|
||||||
../../doc/manual/source/protocols/json/schema
|
../../doc/manual/source/protocols/json/schema
|
||||||
../../src/libutil-tests/data/hash
|
../../src/libutil-tests/data/hash
|
||||||
../../src/libstore-tests/data/derivation
|
../../src/libstore-tests/data/derivation
|
||||||
|
../../src/libstore-tests/data/derived-path
|
||||||
./.
|
./.
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue