Open ianballou opened 6 days ago
I suspect the pulpcore version at the time of creating the bindings may have been different from 3.49.9.
See also https://discourse.pulpproject.org/t/we-will-stop-publishing-bindings-soon/1240
If that's the cause, even more reason for us to start generating the bindings ourselves. I can try pulp-rpm 3.26 for now if that would be preferable.
I've confirmed that regenerating the bindings myself fixes the issue. In comparing the generated bindings with the bindings on rubygems.org, I'm seeing references to AnyType
that seem to be the cause of the problem:
diff -r /home/vagrant/foreman/.vendor/ruby/3.0.0/gems/pulp_rpm_client-3.27.1/lib/pulp_rpm_client/models/rpm_package_response.rb ../pulp-openapi-generator/pulp_rpm-client/lib/pulp_rpm_client/models/rpm_package_response.rb
230,239c230,239
< :'changelogs' => :'AnyType',
< :'files' => :'AnyType',
< :'requires' => :'AnyType',
< :'provides' => :'AnyType',
< :'conflicts' => :'AnyType',
< :'obsoletes' => :'AnyType',
< :'suggests' => :'AnyType',
< :'enhances' => :'AnyType',
< :'recommends' => :'AnyType',
< :'supplements' => :'AnyType',
---
> :'changelogs' => :'Object',
> :'files' => :'Object',
> :'requires' => :'Object',
> :'provides' => :'Object',
> :'conflicts' => :'Object',
> :'obsoletes' => :'Object',
> :'suggests' => :'Object',
> :'enhances' => :'Object',
> :'recommends' => :'Object',
> :'supplements' => :'Object',
and
diff -r /home/vagrant/foreman/.vendor/ruby/3.0.0/gems/pulp_rpm_client-3.27.1/lib/pulp_rpm_client/models/rpm_package_environment_response.rb ../pulp-openapi-generator/pulp_rpm-client/lib/pulp_rpm_client/models/rpm_package_environment_response.rb
81,84c81,84
< :'group_ids' => :'AnyType',
< :'option_ids' => :'AnyType',
< :'desc_by_lang' => :'AnyType',
< :'name_by_lang' => :'AnyType',
---
> :'group_ids' => :'Object',
> :'option_ids' => :'Object',
> :'desc_by_lang' => :'Object',
> :'name_by_lang' => :'Object',
for examples.
We (Katello) still need to come up with a solid plan to create our own Ruby bindings. Building the bindings ourselves is easy as a one-off, but we'd need our self-generation process ironed out before we can start doing it reliably. Is there any way this can be handled without us having to monkey-patch things?
Is there any way this can be handled without us having to monkey-patch things?
@ianballou Are you talking about the short-term (handling this specific issue) or the long-term (working on the self-generation process)?
We'd be happy to work with you on getting the long-term process sorted out.
@dralley I was talking about the short term. For our upcoming Katello 4.14, if we need to generate our own bindings, it would need to be done manually each time. It's not impossible, but there's always the risk of our packaging automation being used to bump the pulp_rpm_client version and having a new version pulled from rubygems.
After some investigation and experimentation, these are my conclusions:
api.json
files is that the regression is missing a type
attribute on some fields:
diff --git a/tmp/wrong-api.json b/tmp/right-api.json
index fc0ae2d..5fd2c53 100644
--- a/tmp/wrong-api.json
+++ b/tmp/right-api.json
@@ -9066,6 +9066,7 @@
"description": "A serializer for Content Copy API.",
"properties": {
"config": {
The experiment was:
I'm not sure what is the way to go, but some general approaches I see are:
Actually not specifying the type: object
is correct from the openapiv3 specification side. This is a bug that was fixed in spectacular. A JSONField can hold any type, including lists and strings, numbers and booleans. "object" from the JSON Schema Specification however only allows dictionaries.
My conclusion is, that the ruby templates in openapi-generator (or at least the ancient version we currently employ) do not handle that valid case properly.
But I would still suggest to go into the viewset and add @extend_schema
decorators, defining what exactly the plugin expects to see in that json field.
@pedro-psb Wow. Great work!
Version
pulp-rpm 3.27.1 (client has same version)
Tested with Katello 4.14.develop
Describe the bug Creating a repository returns a traceback. The repo does get created, but there's an error.
To Reproduce Try to create an RPM repo with the Ruby bindings
Expected behavior Repo is created without an error.