Skip to content

Commit 37bd3e0

Browse files
docs: add docs for new schemas
1 parent cd5845b commit 37bd3e0

3 files changed

Lines changed: 45 additions & 0 deletions

File tree

docs/BUILDING_CUSTOM_ENDPOINT_CLASSES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ The `tag` property is used to define the [OpenAPI tag](https://swagger.io/docs/s
108108
for the endpoint. This is used to group related endpoints together in the API documentation. This property is optional
109109
and defaults to the first section of the URL after the `/api/v2/` prefix.
110110

111+
### deprecated
112+
113+
The `deprecated` property is used to indicate if the endpoint is deprecated. This property defaults to `false`. When set
114+
to `true`, the endpoint will be marked as deprecated in applicable documentation and schemas.
115+
111116
### requires_auth
112117

113118
The `requires_auth` property is used to specify whether the endpoint requires authentication and authorization. This property

docs/NATIVE_SCHEMA.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Native Schema
2+
3+
The package's framework also generates a proprietary schema that describes components of the API in more detail than
4+
the OpenAPI or GraphQL schemas. This is intended for third-party tools and integrations that need more context about
5+
the API's structure, behavior and attributes. The native schema is generated by extracting data the codebases PHP class
6+
properties directly and use internal metadata that is not normally exposed.
7+
8+
## Accessing the Schema
9+
10+
The native schema can by obtained by making a `GET` request to the `/api/v2/schema/native` endpoint. This endpoint
11+
does not require authentication and is accessible to all users as it only provides descriptive metadata about the API
12+
that is already publicly available by referencing the code on GitHub.
13+
14+
## Understanding the Structure
15+
16+
Since the native schema is generated from the codebase itself, the easiest way to understand its contents is to
17+
review the properties available to [Endpoint](BUILDING_CUSTOM_ENDPOINT_CLASSES.md#define-__construct-method-properties),
18+
[Model](BUILDING_CUSTOM_MODEL_CLASSES.md#define-__construct-method-properties) and [Field](BUILDING_CUSTOM_MODEL_CLASSES.md#define-field-objects)
19+
classes. Below is a basic outline of the schema's structure:
20+
21+
```json
22+
{
23+
"endpoints": {
24+
"/endpoint/url/path": {
25+
...
26+
}
27+
},
28+
"models": {
29+
"ModelName": {
30+
"fields": {
31+
"field_name": {
32+
...
33+
},
34+
...
35+
}
36+
}
37+
}
38+
}
39+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ nav:
2626
- Building Custom Dispatchers: BUILDING_CUSTOM_DISPATCHER_CLASSES.md
2727
- Building Custom Caches: BUILDING_CUSTOM_CACHE_CLASSES.md
2828
- Building Custom Content Handlers: BUILDING_CUSTOM_CONTENT_HANDLER_CLASSES.md
29+
- Native Schema: NATIVE_SCHEMA.md
2930
- PHP Reference: https://pfrest.org/php-docs/
3031
theme:
3132
name: readthedocs

0 commit comments

Comments
 (0)