Mojolicious-Plugin-Fondation-OpenAPI
view release on metacpan or search on metacpan
This plugin requires [Fondation::Model::DBIx::Async](https://metacpan.org/pod/Fondation%3A%3AModel%3A%3ADBIx%3A%3AAsync).
Transitively, it depends on [Mojolicious::Plugin::OpenAPI](https://metacpan.org/pod/Mojolicious%3A%3APlugin%3A%3AOpenAPI) >= 5.12,
which requires [JSON::Validator](https://metacpan.org/pod/JSON%3A%3AValidator) >= 5.17.
## Perl 5.40 Incompatibility
On Perl >= 5.40, [Net::IDN::Encode](https://metacpan.org/pod/Net%3A%3AIDN%3A%3AEncode) (a dependency of JSON::Validator
5.17+) fails to compile because its XS code calls `uvuni_to_utf8_flags`,
removed from the Perl C API in 5.40. This cascades:
Net::IDN::Encode â compile FAIL (Perl ⥠5.40)
â JSON::Validator 5.17+ â blocked by cpanm
â Mojolicious::Plugin::OpenAPI 5.12 â blocked
**Workaround on Debian:** the `libnet-idn-encode-perl` package provides
a pre-compiled version that works on Perl 5.40:
apt install libnet-idn-encode-perl
lib/Mojolicious/Plugin/Fondation/OpenAPI.pm view on Meta::CPAN
This plugin requires L<Fondation::Model::DBIx::Async>.
Transitively, it depends on L<Mojolicious::Plugin::OpenAPI> E<gt>= 5.12,
which requires L<JSON::Validator> E<gt>= 5.17.
=head2 Perl 5.40 Incompatibility
On Perl E<gt>= 5.40, L<Net::IDN::Encode> (a dependency of JSON::Validator
5.17+) fails to compile because its XS code calls C<uvuni_to_utf8_flags>,
removed from the Perl C API in 5.40. This cascades:
Net::IDN::Encode â compile FAIL (Perl ⥠5.40)
â JSON::Validator 5.17+ â blocked by cpanm
â Mojolicious::Plugin::OpenAPI 5.12 â blocked
B<Workaround on Debian:> the C<libnet-idn-encode-perl> package provides
a pre-compiled version that works on Perl 5.40:
apt install libnet-idn-encode-perl
lib/Mojolicious/Plugin/Fondation/OpenAPI/Command/openapi.pm view on Meta::CPAN
my $src_config = $schemas_config->{$table_name}
// $schemas_config->{$resultname} // {};
my $col_configs = $src_config->{columns} // {};
# Skip sources excluded by plugins
next if $openapi_exclude{$table_name};
# ------------------------------------------------------------------
# STEP A -- Build the API Base (canonical schema)
#
# Three-layer cascade, highest priority wins:
# 1. DBIx structure (implicit: data_type, size, is_nullable, ...)
# 2. extra->{openapi} (flat keys declared in Result class)
# 3. Config override (flat keys in myapp.conf)
#
# After the cascade, writeOnly columns are stripped from the
# API Base â they only appear in create/update/patch contexts.
# ------------------------------------------------------------------
my %api_props;
my @api_required;
for my $col (sort keys %$columns_info) {
my $info = $columns_info->{$col};
my $openapi = $info->{extra}{openapi} // {};
my $cfg = $col_configs->{$col} // {};
my %prop;
lib/Mojolicious/Plugin/Fondation/OpenAPI/Command/openapi.pm view on Meta::CPAN
writeOnly => 1,
create => { required => 1 },
update => { required => 0 },
},
},
},
},
},
Config keys follow the same flat + contextual structure as
C<extra-E<gt>{openapi}> and take the highest priority in the cascade:
1. Structure DBIx (implicit)
2. extra->{openapi} flat keys (Result class)
3. Config flat keys (myapp.conf)
4. extra->{openapi} contextual (Result class)
5. Config contextual (myapp.conf)
=head1 SUBCOMMANDS
=head2 generate
( run in 2.125 seconds using v1.01-cache-2.11-cpan-e7c6538aa59 )