Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
gbicann committed Jul 3, 2024
2 parents 1fb6742 + 381cffd commit 3d7c20d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
33 changes: 33 additions & 0 deletions bin/generate-input-parameter-schema.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

$schema->{$name}->{'description'} = $meta{'Description'};
$schema->{$name}->{'example'} = $meta{'Example'} if (exists($meta{'Example'}));

add_constraints($schema->{$name});
}

say STDERR 'generating YAML fragment for input parameter schemas...';
Expand All @@ -34,3 +36,34 @@
print $yaml;

say STDERR 'done';

sub add_constraints {
my $schema = shift;

if ('url' eq $schema->{format}) {
$schema->{'x-constraints'} = '@ValidUrl';

} elsif ('hostname' eq $schema->{format}) {
$schema->{'x-constraints'} = '@ValidHostname';

} elsif ('array' eq $schema->{type}) {
if ('hostname' eq $schema->{items}->{format}) {
$schema->{'x-constraints'} = '@ValidHostnameList';

} elsif ('ipv4' eq $schema->{items}->{format}) {
$schema->{'x-constraints'} = '@ValidIpv4List';

} elsif ('ipv6' eq $schema->{items}->{format}) {
$schema->{'x-constraints'} = '@ValidIpv6List';

} else {
add_constraints($schema->{items}) if ($schema->{items});

}

} elsif ('object' eq $schema->{type}) {
foreach my $property (keys(%{$schema->{properties}})) {
add_constraints($schema->{properties}->{$property});
}
}
}
10 changes: 4 additions & 6 deletions inc/test-request-base-properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ rsp:
description: |
The RSP's unique ID.
In OT&E, this **MUST** be omitted when creating a new test request, and will
be populated using the FQDN of the first `TLSA` record which matches the
certificate presented by the client.
In OT&E, this **MUST** contain the Fully-Qualified Domain Name where a TLSA
record that validates the client certificate is published.
type: string
example: RSPI2404-M51

Expand Down Expand Up @@ -111,9 +110,8 @@ clientIDs:
An array of FQDNs at which one or more `TLSA` records may be found
which can be used for authentication.
In OT&E, this **MUST** be omitted when creating a new test request, but the
resulting test will be populated with the FQDN of the first `TLSA` record
which matches the certificate presented by the client.
In OT&E, this **MUST** contain the Fully-Qualified Domain Name where a TLSA
record that validates the client certificate is published.
type: array
minItems: 1
items:
Expand Down
7 changes: 7 additions & 0 deletions rst-api-spec.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ info:

### Change Log

* 2024-07-03:
* `x-constraints` properties have been added to input parameter schemas,
where appropriate, to facilitate automated validation in Java
applications.
* When creating tests in the OT&E environment, the `rsp` and `clientIDs`
**MUST** now be specified and **MUST** contain the FQDN at which a TLSA
record that validates the client certificate is published.
* 2024-06-26:
* added the `/v1/resource/{file}` endpoint.
* 2024-06-05:
Expand Down

0 comments on commit 3d7c20d

Please sign in to comment.