pmm icon indicating copy to clipboard operation
pmm copied to clipboard

PMM-10495 Avoid swagger validation when browsing /swagger

Open cezmunsta opened this issue 2 years ago • 6 comments

By default, Swagger UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators (Validator Badge). Setting it to either none, 127.0.0.1 or localhost will disable validation.

https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/#network

  • Set validatorUrl to an empty string

PMM-10495

Build: SUBMODULES-2701

cezmunsta avatar Aug 10 '22 09:08 cezmunsta

Codecov Report

Merging #1140 (c2ff622) into main (3821ef4) will increase coverage by 0.10%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #1140      +/-   ##
==========================================
+ Coverage   45.27%   45.37%   +0.10%     
==========================================
  Files         140      140              
  Lines       13568    13568              
==========================================
+ Hits         6143     6157      +14     
+ Misses       7033     7019      -14     
  Partials      392      392              
Flag Coverage Δ
admin 24.41% <ø> (ø)
agent 54.03% <ø> (+0.14%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
agent/agents/mysql/slowlog/slowlog.go 51.27% <0.00%> (+2.97%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Aug 10 '22 09:08 codecov[bot]

Ceri, this is quite hard to review. Is there any way for us to "rebuild from source"? I know we are just grabbing the files from swagger's ui repo, but I was wondering how you actually made those changes to compiled files?

ademidoff avatar Aug 10 '22 10:08 ademidoff

Ceri, this is quite hard to review. Is there any way for us to "rebuild from source"? I know we are just grabbing the files from swagger's ui repo, but I was wondering how you actually made those changes to compiled files?

@atymchuk they aren't compiled, just minified from what I can tell. It was simply applying the workaround from the ticket:

sed -i 's;validatorUrl:"https://validator.swagger.io/validator";validatorUrl:"";g' *

How are the files normally updated? I didn't notice a make command to pull in files, so I presume that it is manual, in which case perhaps Makefile.include needs something extra

cezmunsta avatar Aug 10 '22 10:08 cezmunsta

How are the files normally updated? I didn't notice a make command to pull in files, so I presume that it is manual, in which case perhaps Makefile.include needs something extra

I believe they are copied from here

ademidoff avatar Aug 10 '22 10:08 ademidoff

@BupycHuk that file is also part of the bundle when downloaded, so really it only reduces the number of files that need to be edited. I have added download_swagger and update_swagger, so make update_swagger can be used to pull in the latest version and patch swagger-initializer.js as part of the process

cezmunsta avatar Aug 10 '22 12:08 cezmunsta

@cezmunsta, yeah, but it's much easier to see differences in the configuration file than in obfuscated files

BupycHuk avatar Aug 10 '22 12:08 BupycHuk