Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes 3877: Add required fields for API spec requests #870

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

Andrewgdewar
Copy link
Contributor

Summary

  • Add required fields for API spec requests.

Testing steps

@jlsherrill
Copy link
Member

@swadeley
Copy link
Member

swadeley commented Nov 1, 2024

Hi

How to test these changes?

If I take the first one:

   "definitions": {
        "api.AddUploadsRequest": {
            "type": "object",
            "required": [
                "artifacts",
                "uploads"
            ],

Looking at "add_upload" in ephemeral I do not see anything different to that in stage:

app.content_sources.rest_client.repositories_api.add_upload.
                                                                      allowed_values  call_with_http_info() headers_map           params_map           
                                                                      api_client            callable()            location_map          settings             
                                                                      attribute_map         collection_format_map openapi_types         validations        

@jlsherrill
Copy link
Member

I don't know that the changes need to be tested, but if you regenerate the api bindings you will see that code will likely need to be changed. for example, this method signature changes:

@@ -102,9 +102,12 @@ class ApiContentUnitSearchRequest(ModelNormal):
     ])

     @convert_js_args_to_python_args
-    def __init__(self, *args, **kwargs):  # noqa: E501
+    def __init__(self, search, *args, **kwargs):  # noqa: E501
         """ApiContentUnitSearchRequest - a model defined in OpenAPI

+        Args:
+            search (str): Search string to search content unit names
+

So if you are using the generated bindings its clearer that 'search' is required to be specified. This doesn't actually change the behavior of the API at all (hence why the tests all pass without generating the bindings)

pkg/api/content_units.go Outdated Show resolved Hide resolved
pkg/api/content_units.go Outdated Show resolved Hide resolved
pkg/api/rpms.go Outdated Show resolved Hide resolved
pkg/api/templates.go Outdated Show resolved Hide resolved
@rverdile rverdile self-assigned this Nov 11, 2024
pkg/api/uploads.go Outdated Show resolved Hide resolved
@Andrewgdewar
Copy link
Contributor Author

Thanks for the review @rverdile @xbhouse!

@rverdile
Copy link
Contributor

rverdile commented Nov 12, 2024

there's some tests failing :)

you might have to rebase as well

pkg/api/templates.go Outdated Show resolved Hide resolved
Copy link
Contributor

@rverdile rverdile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I saw them before, but TemplateRequest and RepositoryRequest are missing

pkg/api/repositories.go Outdated Show resolved Hide resolved
@Andrewgdewar
Copy link
Contributor Author

I thought I saw them before, but TemplateRequest and RepositoryRequest are missing

Thanks for the feedback here, I did add to the template and repository request. Please confirm if those changes make sense.

pkg/api/content_units.go Outdated Show resolved Hide resolved
@rverdile
Copy link
Contributor

that's my last comment :)

@Andrewgdewar
Copy link
Contributor Author

@rverdile @xbhouse Thank you for your thorough review here, I'm still learning 🍼 👶, I appreciate your patience!!

Copy link
Contributor

@rverdile rverdile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@swadeley
Copy link
Member

/retest

@swadeley
Copy link
Member

swadeley commented Nov 18, 2024

Hi

I found that I had to add origin="external to all repo create calls.
No changes to anything related to search this time (search calls had origin="external from a while back)

@rverdile
Copy link
Contributor

Ah, it seems origin is actually not a required field. We should remove that then.

@swadeley swadeley merged commit 663e860 into content-services:main Nov 18, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants