Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/NATIVE_SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classes. Below is a basic outline of the schema's structure:

```json
{
"version": "v0.0.0",
"endpoints": {
"/endpoint/url/path": {
...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class DHCPServer extends Model {
# Loop through each defined interface
foreach ($this->get_config('interfaces', []) as $if_id => $if) {
# Skip this interface if it is not a static interface or the subnet value is greater than or equal to 31
if (empty($if['ipaddr']) or $if['ipaddr'] !== 'static' or $if->subnet->value >= 31) {
if (empty($if['ipaddr']) or !is_ipaddrv4($if['ipaddr']) or $if->subnet->value >= 31) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use RESTAPI\Core\Model;
use RESTAPI\Core\Schema;
use RESTAPI\Fields\ForeignModelField;
use RESTAPI\Fields\NestedModelField;
use RESTAPI\Models\RESTAPIVersion;
use function RESTAPI\Core\Tools\get_classes_from_namespace;

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

# Get all endpoint metadata
foreach (get_classes_from_namespace('RESTAPI\Endpoints') as $endpoint_class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ class APIModelsDHCPServerTestCase extends TestCase {
* Ensures non-static interfaces are exempt from DHCP server initialization. This is a regression test for #781
*/
public function test_non_static_interfaces_exempt_from_dhcp_server_initialization(): void {
# Ensure no config entry exists for the `opt1` DHCP server
Model::del_config('dhcpd/opt1');

# Temporarily add a mock interface using pppoe for IPv4
Model::set_config('interfaces/opt1/ipaddr', 'pppoe');

Expand Down