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

Webhooks not rendered in generated spec #4673

Open
mark-roy opened this issue May 17, 2024 · 0 comments
Open

Webhooks not rendered in generated spec #4673

mark-roy opened this issue May 17, 2024 · 0 comments
Assignees

Comments

@mark-roy
Copy link

I have a project that I have been successfully generating openapi.json using Swagger annotations v2.2.22. I've taken the @webhooks example from modules/swagger-jaxrs2/src/test/java/io/swagger/v3/jaxrs2/petstore/WebHookResource.java and added it to my project, but have not been able to get webhooks rendered in the spec file.

I've debugged the decompiled code to this point in SpecFilter, where the resourcePath is "webhook2" (from the example hook). The code then does a 'get' on that resource path and gets null on return, which it passes on to filterPathItem. Eventually this results in a NullPointerException.

            if (filteredOpenAPI.getWebhooks() != null) {
                Iterator var18 = filteredOpenAPI.getWebhooks().keySet().iterator();

                while(var18.hasNext()) {
                    String resourcePath = (String)var18.next();
                    pathItem = (PathItem)filteredOpenAPI.getPaths().get(resourcePath);
                    filteredPathItem = this.filterPathItem(filter, pathItem, resourcePath, params, cookies, headers);
                    PathItem clonedPathItem = this.cloneFilteredPathItem(filter, filteredPathItem, resourcePath, params, cookies, headers, allowedTags, filteredTags);
                    if (clonedPathItem != null && !clonedPathItem.readOperations().isEmpty()) {
                        clone.addWebhooks(resourcePath, clonedPathItem);
                    }
                }
            }

Do I need to define a @path("webhook2") somewhere? The example code doesn't seem to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants