|
| 1 | +# Discovery Schema |
| 2 | + |
| 3 | +Discovery service responses following [the MFWG schema specification](https://github.com/awslabs/frontend-discovery) are directly supported. |
| 4 | + |
| 5 | +::: tip |
| 6 | +Follow the JSON schema defined in the linked [GitHub repository](https://github.com/awslabs/frontend-discovery/blob/main/schema/v1-pre.json) for making your own discovery service compatible with Picard. |
| 7 | +::: |
| 8 | + |
| 9 | +## Schema Description |
| 10 | + |
| 11 | +The returned response has either to be an object with a property named `microFrontends`, which is an object again - consisting of a mapping of names of micro frontends to their different definitions (i.e., one or more definitions per version). |
| 12 | + |
| 13 | +## Mapping of Properties |
| 14 | + |
| 15 | +### Module Federation |
| 16 | + |
| 17 | +To be recognized as a micro frontend using Module Federation the entry needs to have a section `modulefederation` placed on `extras` of the definition. Alternatively, if the URL ends with `.js` and no other type has been recognized Picard.js will fall back to Module Federation. |
| 18 | + |
| 19 | +| Property | Description | |
| 20 | +| ------------------------- | --------------------------------------------------- | |
| 21 | +| `[key]` | Name of the micro frontend | |
| 22 | +| `[value]` | The micro frontend definition | |
| 23 | +| `def.url` | Link to the remote entry manifest | |
| 24 | +| `def.extras.id` | The global name of the remote | |
| 25 | +| `def.extras.metaData` | The `metaData` section of the remote entry manifest | |
| 26 | +| `def.extras.exposes` | The `exposes` section of the remote entry manifest | |
| 27 | +| `def.extras.remotes` | The `remotes` section of the remote entry manifest | |
| 28 | +| `def.extras.shared` | The `shared` section of the remote entry manifest | |
| 29 | +| `def.extras.runtime` | The MF runtime version (e.g., `1.0` or `2.0`) | |
| 30 | +| `def.extras.type` | The type (`esm` / `module` or `var` / `global`) | |
| 31 | + |
| 32 | +::: warning |
| 33 | +It is crucial that the right runtime version of Module Federation is transported. While a missing `runtime` value could still be inferred correctly, an incorrect one will almost certainly lead to a wrong interpretation of the micro frontend. |
| 34 | +::: |
| 35 | + |
| 36 | +### Native Federation |
| 37 | + |
| 38 | +To be recognized as a micro frontend using Native Federation the entry needs to have a section `nativefederation` placed on `extras` of the definition. |
| 39 | + |
| 40 | +| Property | Description | |
| 41 | +| ------------------------- | --------------------------------------------------- | |
| 42 | +| `[key]` | Name of the micro frontend | |
| 43 | +| `[value]` | The micro frontend definition | |
| 44 | +| `def.url` | Link to the remote entry JSON | |
| 45 | +| `def.extras.exposes` | The `exposes` section of the remote entry JSON | |
| 46 | +| `def.extras.dependencies` | The `dependencies` section of the remote entry JSON | |
| 47 | + |
| 48 | +### Pilets |
| 49 | + |
| 50 | +To be recognized as a micro frontend using Piral (i.e., a pilet) the entry needs to have a section `pilet` placed on `extras` of the definition. |
| 51 | + |
| 52 | +| Property | Description | |
| 53 | +| ------------------------- | --------------------------------------------------- | |
| 54 | +| `[key]` | Name of the micro frontend | |
| 55 | +| `[value]` | The micro frontend definition | |
| 56 | +| `def.url` | Link to the entry module | |
| 57 | +| `def.extras.dependencies` | The `dependencies` section of pilet | |
| 58 | +| `def.extras.config` | The `config` section of the pilet | |
| 59 | +| `def.extras.pilet.spec` | The `spec` section of the pilet | |
| 60 | +| `def.version` | The `version` of the pilet | |
| 61 | +| `def.integrity` | The `integrity` section of the pilet | |
| 62 | + |
| 63 | +### Anything Else |
| 64 | + |
| 65 | +**This is not supported** (right now). |
| 66 | + |
| 67 | +All values in the discovery schema are interepreted as one of the previously three mentioned formats. If you know another format that can be / is transported commonly then let us know! |
0 commit comments