Skip to content

Commit

Permalink
Check if controller can handle primary_key
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouzierinverse committed Nov 25, 2024
1 parent 2652fb8 commit 66f7bd8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/pf/UnifiedApi/OpenAPI/Generator/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ sub operation_generators {
sub resourceParameters {
my ( $self, $scope, $c, $m, $a ) = @_;
my $parameters = $self->operationParameters( $scope, $c, $m, $a );
my $parameter = $self->path_parameter($c->primary_key);
$parameter->{required} = JSON::MaybeXS::true;
$parameter->{description} = '`PRIMARY KEY`';
my $parameter = undef;
if ($c->can("primary_key")) {
$parameter = $self->path_parameter($c->primary_key);
$parameter->{required} = JSON::MaybeXS::true;
$parameter->{description} = '`PRIMARY KEY`';
}
if (ref($c) =~ /Config::.*(?<!Subtype)$/ && $c->config_store->importConfigFile) {
my $ini = Config::IniFiles->new(
-file => $c->config_store->importConfigFile,
Expand All @@ -110,7 +113,8 @@ sub resourceParameters {
$parameter->{schema}->{enum} = [sort @$enum];
}
}
push @$parameters, $parameter;

push @$parameters, $parameter if defined $parameter;
return $parameters;
}

Expand Down

0 comments on commit 66f7bd8

Please sign in to comment.