Skip to content

remove invalid example for GET show netem property containerName#67

Merged
FloSch62 merged 1 commit intosrl-labs:mainfrom
mxyns:remove-swagger-invalid-example
Feb 10, 2026
Merged

remove invalid example for GET show netem property containerName#67
FloSch62 merged 1 commit intosrl-labs:mainfrom
mxyns:remove-swagger-invalid-example

Conversation

@mxyns
Copy link
Contributor

@mxyns mxyns commented Feb 10, 2026

here is the output of the openapi-generator-cli with the current swagger.json:

2026-02-10 15:51:43 (4.06 MB/s) - ‘/tmp/openapi-generator-cli.jar’ saved [31060598/31060598]

Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
 | Error count: 1, Warning count: 0
Errors: 
        -attribute paths.'/api/v1/tools/netem/show'(get).[containerName].example is unexpected

        at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:718)
        at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:745)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:527)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

this PR addresses the issue by removing the invalid example from the swagger

@mxyns
Copy link
Contributor Author

mxyns commented Feb 10, 2026

a CI with automatic validation of the swagger with the official openapi tool could be nice 🙂

@FloSch62
Copy link
Member

@mxyns

The swagger files are auto generated by task wag

Looking at internal/api/tools_handlers.go:750, the swag annotation is:
// @param containerName query string true "Container/node name" example(clab-my-lab-srl1)

This is where the example value comes from. The PR is removing the example from the generated output files, but the annotation in the source code still has it. So the next time someone runs swag init, the example will come right back.

@mxyns
Copy link
Contributor Author

mxyns commented Feb 10, 2026

ah didn't know that, my bad. thanks for the heads up i'll fix it. that means that my previous PR which has been merged was bad as well and was overwritten: #61

@mxyns mxyns force-pushed the remove-swagger-invalid-example branch from 8a4697b to 1dc7859 Compare February 10, 2026 10:09
@FloSch62
Copy link
Member

ah didn't know that, my bad. thanks for the heads up i'll fix it. that means that my previous PR which has been merged was bad as well and was overwritten: #61

yes sorry about #61, thats my fault, I overlooked the change

@FloSch62 FloSch62 merged commit c157b4e into srl-labs:main Feb 10, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants