Skip to content

Commit 67c26e1

Browse files
committed
Document vocabulary extension
1 parent b953a84 commit 67c26e1

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"Pico",
7070
"Pixelfed",
7171
"PKCS",
72+
"Pleroma",
7273
"popd",
7374
"poppanator",
7475
"proto",

docs/manual/vocab.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ list of the objects, please refer to the [API reference].
4949
[API reference]: https://jsr.io/@fedify/fedify/doc/vocab/~
5050
[`Object`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object
5151
52+
5253
Instantiation
5354
-------------
5455
@@ -492,3 +493,45 @@ corresponding TypeScript types:
492493
[BCP 47]: https://www.rfc-editor.org/info/bcp47
493494
[`LanguageTag`]: https://phensley.github.io/cldr-engine/docs/en/api-languagetag
494495
[`CryptoKey`]: https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey
496+
497+
498+
Extending the vocabulary
499+
------------------------
500+
501+
While Fedify's vocabulary API offers many advantages, it has a limitation due to
502+
its implementation through code generation: it is difficult to extend with
503+
custom types or custom properties that are not included in the Activity
504+
Vocabulary and major vendor extensions provided by Fedify. This means that
505+
adding custom types or properties at runtime is challenging, and if you want to
506+
add new types or properties, you need to contribute to the Fedify upstream
507+
repository.
508+
509+
Fortunately, Fedify's vocabulary API is very open to external contributions,
510+
and technically, adding new types or properties to the vocabulary API is not
511+
difficult.
512+
513+
The Fedify project accepts contributions to the vocabulary API almost
514+
unconditionally if any of the following conditions are met:
515+
516+
- The type or property is specified in some form as a [FEP] (Fediverse
517+
Enhancement Proposal) or equivalent specification document
518+
- The type or property is already adopted and used by widely-used
519+
implementations in the fediverse such as Mastodon, Pleroma, etc.
520+
- The type or property has been sufficiently discussed in the Fedify
521+
community ([Discord], [Matrix], [GitHub Discussions], etc.)
522+
523+
If you want to contribute to Fedify's vocabulary API, the process is
524+
straightforward. The _\*.yaml_ files located in the *fedify/vocab/* directory
525+
of the Fedify repository serve as the source data for code generation. To add
526+
a new type, you simply need to add a new *.yaml* file, and to add a new
527+
property, you need to define the new property in the `properties` section of an
528+
existing *.yaml* file.
529+
530+
For detailed information on how to contribute to the vocabulary API, please
531+
refer to the [*Contributing guide*](../contribute.md) and the existing YAML
532+
files in the *fedify/vocab/* directory for examples.
533+
534+
[FEP]: https://w3id.org/fep/
535+
[Discord]: https://discord.gg/bhtwpzURwd
536+
[Matrix]: https://matrix.to/#/#fedify:matrix.org
537+
[GitHub Discussions]: https://github.com/fedify-dev/fedify/discussions

0 commit comments

Comments
 (0)