Skip to content

Commit 195f2eb

Browse files
feat(NativeSchema): include API version in native schema
1 parent eadf2aa commit 195f2eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Schemas/NativeSchema.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use RESTAPI\Core\Model;
1010
use RESTAPI\Core\Schema;
1111
use RESTAPI\Fields\ForeignModelField;
1212
use RESTAPI\Fields\NestedModelField;
13+
use RESTAPI\Models\RESTAPIVersion;
1314
use function RESTAPI\Core\Tools\get_classes_from_namespace;
1415

1516
/**
@@ -129,7 +130,8 @@ class NativeSchema extends Schema {
129130
* @return string The full schema string for this Schema class in JSON format
130131
*/
131132
public function get_schema_str(): string {
132-
$schema = ['endpoints' => [], 'models' => []];
133+
$version = new RESTAPIVersion();
134+
$schema = ['version' => $version->current_version->value, 'endpoints' => [], 'models' => []];
133135

134136
# Get all endpoint metadata
135137
foreach (get_classes_from_namespace('RESTAPI\Endpoints') as $endpoint_class) {

0 commit comments

Comments
 (0)