You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -320,9 +319,9 @@ The JSON object returned by ``serial.metadata.as_json()`` will now use this anno
320
319
}
321
320
```
322
321
323
-
#### Annotation names and schema URLs
322
+
#### Annotation schema URLs
324
323
325
-
An `Annotation` schema must have a `"$id"` property, which holds an URL that serves as its unique identifier. This URL must have the following format:
324
+
An `Annotation` schema must have a `"$id"` property, which holds an URL that serves as its unique identifier. The following convention is required for the `"$id"` of schemas hosted at https://amaranth-lang.org, and suggested otherwise:
*`<version>` is the version of the aforementioned package;
334
333
*`<path>` is a non-empty string.
335
334
336
-
An `Annotation` name should be retrievable from the `"$id"` property of its schema. Its name is the concatenation of the following parts, separated by `"."`:
335
+
For example:
337
336
338
-
*`<domain>`, reversed (e.g. "com.example");
339
-
*`<package>`;
340
-
*`<path>`, split using `"/"` as separator.
341
-
342
-
Some examples of valid schema URLs:
343
-
344
-
- "https://example.github.io/schema/foo/1.0/serial.json" for the "io.github.example.foo.serial" annotation;
345
-
- "https://amaranth-lang.org/schema/amaranth/0.4/fifo.json" for "org.amaranth-lang.amaranth.fifo";
346
-
- "https://amaranth-lang.org/schema/amaranth-soc/0.1/memory-map.json" for "org.amaranth-lang.amaranth-soc.memory-map".
Changes to schema definitions hosted at https://amaranth-lang.org should follow the [RFC process](https://github.com/amaranth-lang/rfcs).
349
341
@@ -353,11 +345,9 @@ Changes to schema definitions hosted at https://amaranth-lang.org should follow
353
345
### Annotations
354
346
355
347
- add an `Annotation` base class to `amaranth.lib.meta`, with:
356
-
* a `.name` "abstract" class attribute, which must be a string (e.g. "org.amaranth-lang.amaranth-soc.memory-map").
357
348
* a `.schema` "abstract" class attribute, which must be a JSON schema, as a dict.
358
349
* a `.__init_subclass__()` class method, which raises an exception if:
359
350
-`.schema` does not comply with the [2020-12 draft](https://json-schema.org/specification-links#2020-12) of the JSON Schema specification.
360
-
-`.name` cannot be extracted from the `.schema["$id"]` URL (as explained [here](#annotation-names-and-schema-urls)).
361
351
- a `.origin` attribute, which returns the Python object described by an annotation instance.
362
352
* a `.validate()` class method, which takes a JSON instance as argument. An exception is raised if the instance does not comply with the schema.
363
353
* a `.as_json()` abstract method, which must return a JSON instance, as a dict. This instance must be compliant with `.schema`, i.e. `self.validate(self.as_json())` must succeed.
@@ -369,7 +359,6 @@ The following changes are made to `amaranth.lib.wiring`:
369
359
370
360
The following changes are made to `amaranth.lib.wiring`:
371
361
- add a `ComponentMetadata` class, with:
372
-
- a `.name` class attribute, which returns `"org.amaranth-lang.amaranth.component"`.
373
362
- a `.schema` class attribute, which returns a JSON schema of component metadata. Its definition is detailed [below](#component-metadata-schema).
374
363
- a `.validate()` class method, which takes a JSON instance as argument. An exception is raised if the instance does not comply with the schema.
375
364
-`.__init__()` takes a `Component` object as parameter.
@@ -381,7 +370,6 @@ The following changes are made to `amaranth.lib.wiring`:
0 commit comments