From 6f494bc11f10701ef26487dd783e7f6a36a597d7 Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Tue, 3 Mar 2026 01:45:49 +0100 Subject: [PATCH 1/4] chore: relint, tests, doc, ci Maintenance work. * test: upgraded testify/v2, migrated to generic assertions, refactored JSON assertions to leverage testify/v2.4.0 * test(internal/testintegration): re-enacted integration tests as a separate module. The repo thus moves technically to a mono-repo (with committed go.work). Moved the big Azure spec fixture to integration tests. * ci: switched to mono repo workflows, removed local git-cliff config * doc: fixed godoc formatting * doc: fixed discord link Signed-off-by: Frederic BIDON --- .cliff.toml | 181 ----------- .github/wordlist.txt | 37 +++ .github/workflows/auto-merge.yml | 2 +- .github/workflows/bump-release.yml | 30 +- .github/workflows/codeql.yml | 2 +- .github/workflows/contributors.yml | 2 +- .github/workflows/go-test.yml | 2 +- .github/workflows/scanner.yml | 6 +- .github/workflows/tag-release.yml | 3 +- .gitignore | 7 +- .golangci.yml | 3 +- README.md | 2 +- analysis_test/go.mod | 13 - analysis_test/go.sum | 307 ------------------ analyzer.go | 14 +- analyzer_test.go | 106 +++--- doc.go | 55 ++-- fixer_test.go | 22 +- flatten.go | 11 +- flatten_name_test.go | 56 ++-- flatten_options.go | 2 +- flatten_test.go | 241 +++++++------- go.mod | 20 +- go.sum | 37 +-- go.work | 6 + go.work.sum | 13 + internal/antest/helpers.go | 2 +- internal/antest/helpers_test.go | 4 +- internal/debug/debug_test.go | 8 +- internal/flatten/normalize/normalize.go | 10 +- internal/flatten/normalize/normalize_test.go | 32 +- .../flatten/operations/operations_test.go | 8 +- internal/flatten/replace/replace.go | 5 +- internal/flatten/replace/replace_test.go | 16 +- .../flatten/schutils/flatten_schema_test.go | 2 +- internal/flatten/sortref/keys.go | 2 +- internal/flatten/sortref/keys_test.go | 2 +- .../testintegration}/doc_test.go | 5 +- .../fixtures}/azure/applicationGateway.json | 0 .../azure/applicationSecurityGroup.json | 0 .../examples/NetworkInterfaceCreate.json | 0 .../examples/NetworkInterfaceDelete.json | 0 .../NetworkInterfaceEffectiveNSGList.json | 0 ...tworkInterfaceEffectiveRouteTableList.json | 0 .../azure/examples/NetworkInterfaceGet.json | 0 .../NetworkInterfaceIPConfigurationGet.json | 0 .../NetworkInterfaceIPConfigurationList.json | 0 .../azure/examples/NetworkInterfaceList.json | 0 .../examples/NetworkInterfaceListAll.json | 0 .../NetworkInterfaceLoadBalancerList.json | 0 ...etworkInterfaceTapConfigurationCreate.json | 0 ...etworkInterfaceTapConfigurationDelete.json | 0 .../NetworkInterfaceTapConfigurationGet.json | 0 .../NetworkInterfaceTapConfigurationList.json | 0 .../examples/NetworkInterfaceUpdateTags.json | 0 ...PublicIpAddressCreateCustomizedValues.json | 0 .../PublicIpAddressCreateDefaults.json | 0 .../examples/PublicIpAddressCreateDns.json | 0 .../azure/examples/PublicIpAddressDelete.json | 0 .../azure/examples/PublicIpAddressGet.json | 0 .../azure/examples/PublicIpAddressList.json | 0 .../examples/PublicIpAddressListAll.json | 0 .../examples/PublicIpAddressUpdateTags.json | 0 .../fixtures}/azure/loadBalancer.json | 0 .../fixtures}/azure/network.json | 0 .../fixtures}/azure/networkInterface.json | 0 .../fixtures}/azure/networkProfile.json | 0 .../fixtures}/azure/networkSecurityGroup.json | 0 .../fixtures}/azure/networkWatcher.json | 0 .../fixtures}/azure/privateEndpoint.json | 0 .../fixtures}/azure/privateLinkService.json | 0 .../fixtures}/azure/publicIpAddress.json | 0 .../fixtures}/azure/routeTable.json | 0 .../azure/serviceEndpointPolicy.json | 0 .../fixtures}/azure/virtualNetwork.json | 0 .../fixtures}/azure/virtualNetworkTap.json | 0 internal/testintegration/go.mod | 34 ++ internal/testintegration/go.sum | 54 +++ .../testintegration}/helpers_spec_test.go | 17 +- .../testintegration}/spec_test.go | 57 ++-- mixin.go | 5 +- schema_test.go | 94 +++--- 82 files changed, 576 insertions(+), 961 deletions(-) delete mode 100644 .cliff.toml create mode 100644 .github/wordlist.txt delete mode 100644 analysis_test/go.mod delete mode 100644 analysis_test/go.sum create mode 100644 go.work create mode 100644 go.work.sum rename {analysis_test => internal/testintegration}/doc_test.go (88%) rename {fixtures => internal/testintegration/fixtures}/azure/applicationGateway.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/applicationSecurityGroup.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceCreate.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceDelete.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceEffectiveNSGList.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceEffectiveRouteTableList.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceGet.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceIPConfigurationGet.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceIPConfigurationList.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceList.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceListAll.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceLoadBalancerList.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceTapConfigurationCreate.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceTapConfigurationDelete.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceTapConfigurationGet.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceTapConfigurationList.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/NetworkInterfaceUpdateTags.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressCreateCustomizedValues.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressCreateDefaults.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressCreateDns.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressDelete.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressGet.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressList.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressListAll.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/examples/PublicIpAddressUpdateTags.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/loadBalancer.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/network.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/networkInterface.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/networkProfile.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/networkSecurityGroup.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/networkWatcher.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/privateEndpoint.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/privateLinkService.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/publicIpAddress.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/routeTable.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/serviceEndpointPolicy.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/virtualNetwork.json (100%) rename {fixtures => internal/testintegration/fixtures}/azure/virtualNetworkTap.json (100%) create mode 100644 internal/testintegration/go.mod create mode 100644 internal/testintegration/go.sum rename {analysis_test => internal/testintegration}/helpers_spec_test.go (86%) rename {analysis_test => internal/testintegration}/spec_test.go (82%) diff --git a/.cliff.toml b/.cliff.toml deleted file mode 100644 index 702629f..0000000 --- a/.cliff.toml +++ /dev/null @@ -1,181 +0,0 @@ -# git-cliff ~ configuration file -# https://git-cliff.org/docs/configuration - -[changelog] -header = """ -""" - -footer = """ - ------ - -**[{{ remote.github.repo }}]({{ self::remote_url() }}) license terms** - -[![License][license-badge]][license-url] - -[license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg -[license-url]: {{ self::remote_url() }}/?tab=Apache-2.0-1-ov-file#readme - -{%- macro remote_url() -%} - https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} -{%- endmacro -%} -""" - -body = """ -{%- if version %} -## [{{ version | trim_start_matches(pat="v") }}]({{ self::remote_url() }}/tree/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} -{%- else %} -## [unreleased] -{%- endif %} -{%- if message %} - {%- raw %}\n{% endraw %} -{{ message }} - {%- raw %}\n{% endraw %} -{%- endif %} -{%- if version %} - {%- if previous.version %} - -**Full Changelog**: <{{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}> - {%- endif %} -{%- else %} - {%- raw %}\n{% endraw %} -{%- endif %} - -{%- if statistics %}{% if statistics.commit_count %} - {%- raw %}\n{% endraw %} -{{ statistics.commit_count }} commits in this release. - {%- raw %}\n{% endraw %} -{%- endif %}{% endif %} ------ - -{%- for group, commits in commits | group_by(attribute="group") %} - {%- raw %}\n{% endraw %} -### {{ group | upper_first }} - {%- raw %}\n{% endraw %} - {%- for commit in commits %} - {%- if commit.remote.pr_title %} - {%- set commit_message = commit.remote.pr_title %} - {%- else %} - {%- set commit_message = commit.message %} - {%- endif %} -* {{ commit_message | split(pat="\n") | first | trim }} - {%- if commit.remote.username %} -{%- raw %} {% endraw %}by [@{{ commit.remote.username }}](https://github.com/{{ commit.remote.username }}) - {%- endif %} - {%- if commit.remote.pr_number %} -{%- raw %} {% endraw %}in [#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.remote.pr_number }}) - {%- endif %} -{%- raw %} {% endraw %}[...]({{ self::remote_url() }}/commit/{{ commit.id }}) - {%- endfor %} -{%- endfor %} - -{%- if github %} -{%- raw %}\n{% endraw -%} - {%- set all_contributors = github.contributors | length %} - {%- if github.contributors | filter(attribute="username", value="dependabot[bot]") | length < all_contributors %} ------ - -### People who contributed to this release - {% endif %} - {%- for contributor in github.contributors | filter(attribute="username") | sort(attribute="username") %} - {%- if contributor.username != "dependabot[bot]" and contributor.username != "github-actions[bot]" %} -* [@{{ contributor.username }}](https://github.com/{{ contributor.username }}) - {%- endif %} - {%- endfor %} - - {% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %} ------ - {%- raw %}\n{% endraw %} - -### New Contributors - {%- endif %} - - {%- for contributor in github.contributors | filter(attribute="is_first_time", value=true) %} - {%- if contributor.username != "dependabot[bot]" and contributor.username != "github-actions[bot]" %} -* @{{ contributor.username }} made their first contribution - {%- if contributor.pr_number %} - in [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \ - {%- endif %} - {%- endif %} - {%- endfor %} -{%- endif %} - -{%- raw %}\n{% endraw %} - -{%- macro remote_url() -%} - https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} -{%- endmacro -%} -""" -# Remove leading and trailing whitespaces from the changelog's body. -trim = true -# Render body even when there are no releases to process. -render_always = true -# An array of regex based postprocessors to modify the changelog. -postprocessors = [ - # Replace the placeholder with a URL. - #{ pattern = '', replace = "https://github.com/orhun/git-cliff" }, -] -# output file path -# output = "test.md" - -[git] -# Parse commits according to the conventional commits specification. -# See https://www.conventionalcommits.org -conventional_commits = false -# Exclude commits that do not match the conventional commits specification. -filter_unconventional = false -# Require all commits to be conventional. -# Takes precedence over filter_unconventional. -require_conventional = false -# Split commits on newlines, treating each line as an individual commit. -split_commits = false -# An array of regex based parsers to modify commit messages prior to further processing. -commit_preprocessors = [ - # Replace issue numbers with link templates to be updated in `changelog.postprocessors`. - #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/issues/${2}))"}, - # Check spelling of the commit message using https://github.com/crate-ci/typos. - # If the spelling is incorrect, it will be fixed automatically. - #{ pattern = '.*', replace_command = 'typos --write-changes -' } -] -# Prevent commits that are breaking from being excluded by commit parsers. -protect_breaking_commits = false -# An array of regex based parsers for extracting data from the commit message. -# Assigns commits to groups. -# Optionally sets the commit's scope and can decide to exclude commits from further processing. -commit_parsers = [ - { message = "^[Cc]hore\\([Rr]elease\\): prepare for", skip = true }, - { message = "(^[Mm]erge)|([Mm]erge conflict)", skip = true }, - { field = "author.name", pattern = "dependabot*", group = "Updates" }, - { message = "([Ss]ecurity)|([Vv]uln)", group = "Security" }, - { body = "(.*[Ss]ecurity)|([Vv]uln)", group = "Security" }, - { message = "([Cc]hore\\(lint\\))|(style)|(lint)|(codeql)|(golangci)", group = "Code quality" }, - { message = "(^[Dd]oc)|((?i)readme)|(badge)|(typo)|(documentation)", group = "Documentation" }, - { message = "(^[Ff]eat)|(^[Ee]nhancement)", group = "Implemented enhancements" }, - { message = "(^ci)|(\\(ci\\))|(fixup\\s+ci)|(fix\\s+ci)|(license)|(example)", group = "Miscellaneous tasks" }, - { message = "^test", group = "Testing" }, - { message = "(^fix)|(panic)", group = "Fixed bugs" }, - { message = "(^refact)|(rework)", group = "Refactor" }, - { message = "(^[Pp]erf)|(performance)", group = "Performance" }, - { message = "(^[Cc]hore)", group = "Miscellaneous tasks" }, - { message = "^[Rr]evert", group = "Reverted changes" }, - { message = "(upgrade.*?go)|(go\\s+version)", group = "Updates" }, - { message = ".*", group = "Other" }, -] -# Exclude commits that are not matched by any commit parser. -filter_commits = false -# An array of link parsers for extracting external references, and turning them into URLs, using regex. -link_parsers = [] -# Include only the tags that belong to the current branch. -use_branch_tags = false -# Order releases topologically instead of chronologically. -topo_order = false -# Order releases topologically instead of chronologically. -topo_order_commits = true -# Order of commits in each group/release within the changelog. -# Allowed values: newest, oldest -sort_commits = "newest" -# Process submodules commits -recurse_submodules = false - -#[remote.github] -#owner = "go-openapi" diff --git a/.github/wordlist.txt b/.github/wordlist.txt new file mode 100644 index 0000000..b69478b --- /dev/null +++ b/.github/wordlist.txt @@ -0,0 +1,37 @@ +BasePath +CLI +ExternalDocs +JSON +JSONschema +LiftAllOfs +PropagateNameExtensions +RemoveUnused +TODO +Unmarshalling +additionalProperties +allOf +analysed +codegen +collable +defs +dpath +enums +golang +https +indexable +inlined +inoperant +mediatypes +mixin +mixins +omitempty +openapi +param +params +preprocessing +rebases +schemas +statuscode +unmarshalling +unmarshals +yaml diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 9b81e3a..4988b17 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -11,5 +11,5 @@ jobs: permissions: contents: write pull-requests: write - uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@84f8f9c0759d5d1d0c32b18a7abaa0cba65ebcff # v0.2.9 + uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 secrets: inherit diff --git a/.github/workflows/bump-release.yml b/.github/workflows/bump-release.yml index 8d209a6..2aa7d2c 100644 --- a/.github/workflows/bump-release.yml +++ b/.github/workflows/bump-release.yml @@ -3,24 +3,19 @@ name: Bump Release permissions: contents: read + on: workflow_dispatch: inputs: - bump-patch: - description: Bump a patch version release - type: boolean - required: false - default: true - bump-minor: - description: Bump a minor version release - type: boolean - required: false - default: false - bump-major: - description: Bump a major version release - type: boolean + bump-type: + description: Type of bump (patch, minor, major) + type: choice + options: + - patch + - minor + - major + default: patch required: false - default: false tag-message-title: description: Tag message title to prepend to the release notes required: false @@ -36,11 +31,10 @@ jobs: bump-release: permissions: contents: write - uses: go-openapi/ci-workflows/.github/workflows/bump-release.yml@84f8f9c0759d5d1d0c32b18a7abaa0cba65ebcff # v0.2.9 + pull-requests: write + uses: go-openapi/ci-workflows/.github/workflows/bump-release-monorepo.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 with: - bump-patch: ${{ inputs.bump-patch }} - bump-minor: ${{ inputs.bump-minor }} - bump-major: ${{ inputs.bump-major }} + bump-type: ${{ inputs.bump-type }} tag-message-title: ${{ inputs.tag-message-title }} tag-message-body: ${{ inputs.tag-message-body }} secrets: inherit diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e503cb0..426c22c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,5 +18,5 @@ jobs: permissions: contents: read security-events: write - uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@84f8f9c0759d5d1d0c32b18a7abaa0cba65ebcff # v0.2.9 + uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 secrets: inherit diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index c7fcf5b..24ef302 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -14,5 +14,5 @@ jobs: permissions: pull-requests: write contents: write - uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@84f8f9c0759d5d1d0c32b18a7abaa0cba65ebcff # v0.2.9 + uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 secrets: inherit diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index e1ba8d8..7ead0fe 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -13,5 +13,5 @@ on: jobs: test: - uses: go-openapi/ci-workflows/.github/workflows/go-test.yml@84f8f9c0759d5d1d0c32b18a7abaa0cba65ebcff # v0.2.9 + uses: go-openapi/ci-workflows/.github/workflows/go-test-monorepo.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 secrets: inherit diff --git a/.github/workflows/scanner.yml b/.github/workflows/scanner.yml index 76f3451..0606d37 100644 --- a/.github/workflows/scanner.yml +++ b/.github/workflows/scanner.yml @@ -3,9 +3,9 @@ name: Vulnerability scans on: branch_protection_rule: push: - branches: [ "master" ] + branches: ["master"] schedule: - - cron: '18 4 * * 3' + - cron: "18 4 * * 3" permissions: contents: read @@ -15,5 +15,5 @@ jobs: permissions: contents: read security-events: write - uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@84f8f9c0759d5d1d0c32b18a7abaa0cba65ebcff # V0.1.0 + uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 secrets: inherit diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 3c43012..16daaab 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -13,7 +13,8 @@ jobs: name: Create release permissions: contents: write - uses: go-openapi/ci-workflows/.github/workflows/release.yml@84f8f9c0759d5d1d0c32b18a7abaa0cba65ebcff # v0.2.9 + uses: go-openapi/ci-workflows/.github/workflows/release.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 with: tag: ${{ github.ref_name }} + is-monorepo: true secrets: inherit diff --git a/.gitignore b/.gitignore index 87c3bd3..885dc27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -secrets.yml -coverage.out -coverage.txt +*.out *.cov .idea +.env +.mcp.json +.claude/ diff --git a/.golangci.yml b/.golangci.yml index 05808d5..02edc1b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,6 +5,7 @@ linters: - depguard - funlen - godox + - gomoddirectives - exhaustruct - nlreturn - nonamedreturns @@ -12,7 +13,7 @@ linters: - paralleltest - recvcheck - testpackage - - thelper # investigate how to parameterize / fix. Temporarily disabled. + - thelper - tparallel - varnamelen - whitespace diff --git a/README.md b/README.md index d320e76..1a03ffa 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ Maintainers can cut a new release by either: [slack-badge]: https://img.shields.io/badge/slack-blue?link=https%3A%2F%2Fgoswagger.slack.com%2Farchives%2FC04R30YM [slack-url]: https://goswagger.slack.com/archives/C04R30YMU [discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue -[discord-url]: https://discord.gg/DrafRmZx +[discord-url]: https://discord.gg/twZ9BwT3 [license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg diff --git a/analysis_test/go.mod b/analysis_test/go.mod deleted file mode 100644 index 4e96596..0000000 --- a/analysis_test/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/go-openapi/analysis/analysis_test - -go 1.13 - -require ( - github.com/go-openapi/analysis v0.20.1 - github.com/go-openapi/loads v0.21.0 - github.com/go-openapi/spec v0.20.6 - github.com/go-openapi/swag v0.21.1 - github.com/stretchr/testify v1.8.0 -) - -replace github.com/go-openapi/analysis => ../ diff --git a/analysis_test/go.sum b/analysis_test/go.sum deleted file mode 100644 index 3465d28..0000000 --- a/analysis_test/go.sum +++ /dev/null @@ -1,307 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= -github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/errors v0.20.2 h1:dxy7PGTqEh94zj2E3h1cUmQQWiM1+aeCROfAr02EmK8= -github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= -github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= -github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= -github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= -github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= -github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= -github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= -github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= -github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= -github.com/go-openapi/loads v0.19.5/go.mod h1:dswLCAdonkRufe/gSUC3gN8nTSaB9uaS2es0x5/IbjY= -github.com/go-openapi/loads v0.19.7/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= -github.com/go-openapi/loads v0.20.0/go.mod h1:2LhKquiE513rN5xC6Aan6lYOSddlL8Mp20AW9kpviM4= -github.com/go-openapi/loads v0.20.2/go.mod h1:hTVUotJ+UonAMMZsvakEgmWKgtulweO9vYP2bQYKA/o= -github.com/go-openapi/loads v0.21.0 h1:jYtUO4wwP7psAweisP/MDoOpdzsYEESdoPcsWjHDR68= -github.com/go-openapi/loads v0.21.0/go.mod h1:rHYve9nZrQ4CJhyeIIFJINGCg1tQpx2yJrrNo8sf1ws= -github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= -github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= -github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= -github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= -github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= -github.com/go-openapi/runtime v0.19.24 h1:TqagMVlRAOTwllE/7hNKx6rQ10O6T8ZzeJdMjSTKaD4= -github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= -github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= -github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= -github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= -github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= -github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= -github.com/go-openapi/spec v0.19.15/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= -github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= -github.com/go-openapi/spec v0.20.1/go.mod h1:93x7oh+d+FQsmsieroS4cmR3u0p/ywH649a3qwC9OsQ= -github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= -github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= -github.com/go-openapi/spec v0.20.6 h1:ich1RQ3WDbfoeTqTAb+5EIxNmpKVJZWBNah9RAT0jIQ= -github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= -github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= -github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= -github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= -github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= -github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= -github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= -github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= -github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= -github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= -github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= -github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= -github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= -github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= -github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= -github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= -github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= -github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= -github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= -github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= -github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= -github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4= -github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= -github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= -github.com/go-openapi/validate v0.20.3 h1:GZPPhhKSZrE8HjB4eEkoYAZmoWA4+tCemSgINH1/vKw= -github.com/go-openapi/validate v0.20.3/go.mod h1:goDdqVGiigM3jChcrYJxD2joalke3ZXeftD16byIjA4= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= -github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= -github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= -github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= -github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= -github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= -github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= -github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= -github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= -github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= -github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= -github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= -github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= -github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= -github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= -github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= -github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= -github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= -github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= -github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= -go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= -go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= -go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= -go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= -go.mongodb.org/mongo-driver v1.10.0 h1:UtV6N5k14upNp4LTduX0QCufG124fSu25Wz9tu94GLg= -go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/analyzer.go b/analyzer.go index af50a6f..1c91b8c 100644 --- a/analyzer.go +++ b/analyzer.go @@ -306,7 +306,7 @@ func fieldNameFromParam(param *spec.Parameter) string { // whenever an error is encountered while resolving references // on parameters. // -// This function takes as input the spec.Parameter which triggered the +// This function takes as input the [spec.Parameter] which triggered the // error and the error itself. // // If the callback function returns false, the calling function should bail. @@ -329,7 +329,7 @@ func (s *Spec) ParametersFor(operationID string) []spec.Parameter { // Does not assume parameters properly resolve references or that // such references actually resolve to a parameter object. // -// Upon error, invoke a ErrorOnParamFunc callback with the erroneous +// Upon error, invoke a [ErrorOnParamFunc] callback with the erroneous // parameters. If the callback is set to nil, panics upon errors. func (s *Spec) SafeParametersFor(operationID string, callmeOnError ErrorOnParamFunc) []spec.Parameter { gatherParams := func(pi *spec.PathItem, op *spec.Operation) []spec.Parameter { @@ -337,7 +337,7 @@ func (s *Spec) SafeParametersFor(operationID string, callmeOnError ErrorOnParamF s.paramsAsMap(pi.Parameters, bag, callmeOnError) s.paramsAsMap(op.Parameters, bag, callmeOnError) - var res []spec.Parameter + res := make([]spec.Parameter, 0, len(bag)) for _, v := range bag { res = append(res, v) } @@ -388,7 +388,7 @@ func (s *Spec) ParamsFor(method, path string) map[string]spec.Parameter { // Does not assume parameters properly resolve references or that // such references actually resolve to a parameter object. // -// Upon error, invoke a ErrorOnParamFunc callback with the erroneous +// Upon error, invoke a [ErrorOnParamFunc] callback with the erroneous // parameters. If the callback is set to nil, panics upon errors. func (s *Spec) SafeParamsFor(method, path string, callmeOnError ErrorOnParamFunc) map[string]spec.Parameter { res := make(map[string]spec.Parameter) @@ -516,7 +516,7 @@ func (s *Spec) AllDefinitions() (result []SchemaRef) { return } -// AllDefinitionReferences returns json refs for all the discovered schemas. +// AllDefinitionReferences returns JSON references for all the discovered schemas. func (s *Spec) AllDefinitionReferences() (result []string) { for _, v := range s.references.schemas { result = append(result, v.String()) @@ -525,7 +525,7 @@ func (s *Spec) AllDefinitionReferences() (result []string) { return } -// AllParameterReferences returns json refs for all the discovered parameters. +// AllParameterReferences returns JSON references for all the discovered parameters. func (s *Spec) AllParameterReferences() (result []string) { for _, v := range s.references.parameters { result = append(result, v.String()) @@ -534,7 +534,7 @@ func (s *Spec) AllParameterReferences() (result []string) { return } -// AllResponseReferences returns json refs for all the discovered responses. +// AllResponseReferences returns JSON references for all the discovered responses. func (s *Spec) AllResponseReferences() (result []string) { for _, v := range s.references.responses { result = append(result, v.String()) diff --git a/analyzer_test.go b/analyzer_test.go index ad7f8cf..4823707 100644 --- a/analyzer_test.go +++ b/analyzer_test.go @@ -113,11 +113,11 @@ func TestAnalyzer_All(t *testing.T) { assert.Len(t, ops["GET"], 2) op, ok := analyzer.OperationFor("get", "/") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) op, ok = analyzer.OperationFor("delete", "/") - assert.False(t, ok) + assert.FalseT(t, ok) assert.Nil(t, op) // check for duplicates in sec. requirements for operation @@ -202,7 +202,7 @@ func TestAnalyzer_DefinitionAnalysis(t *testing.T) { allOfs := analyzer.allOfs assert.Len(t, allOfs, 1) - assert.Contains(t, allOfs, "#/definitions/withAllOf") + assert.MapContainsT(t, allOfs, "#/definitions/withAllOf") } func TestAnalyzer_ReferenceAnalysis(t *testing.T) { @@ -355,10 +355,10 @@ func TestAnalyzer_PatternAnalysis(t *testing.T) { // patternProperties (beyond Swagger 2.0) _, ok := an.spec.Definitions["withPatternProperties"] - assert.True(t, ok) + assert.TrueT(t, ok) _, ok = an.allSchemas["#/definitions/withPatternProperties/patternProperties/^prop[0-9]+$"] - assert.True(t, ok) + assert.TrueT(t, ok) } func TestAnalyzer_ParamsAsMap(t *testing.T) { @@ -369,15 +369,15 @@ func TestAnalyzer_ParamsAsMap(t *testing.T) { m := make(map[string]spec.Parameter) pi, ok := s.spec.Paths.Paths["/items"] - require.True(t, ok) + require.TrueT(t, ok) s.paramsAsMap(pi.Parameters, m, nil) assert.Len(t, m, 1) p, ok := m["query#Limit"] - require.True(t, ok) + require.TrueT(t, ok) - assert.Equal(t, "limit", p.Name) + assert.EqualT(t, "limit", p.Name) // An invalid spec, but passes this step (errors are figured out at a higher level) s = prepareTestParamsInvalid(t, "fixture-1289-param.yaml") @@ -385,16 +385,16 @@ func TestAnalyzer_ParamsAsMap(t *testing.T) { m = make(map[string]spec.Parameter) pi, ok = s.spec.Paths.Paths["/fixture"] - require.True(t, ok) + require.TrueT(t, ok) pi.Parameters = pi.Get.Parameters s.paramsAsMap(pi.Parameters, m, nil) assert.Len(t, m, 1) p, ok = m["body#DespicableMe"] - require.True(t, ok) + require.TrueT(t, ok) - assert.Equal(t, "despicableMe", p.Name) + assert.EqualT(t, "despicableMe", p.Name) } func TestAnalyzer_ParamsAsMapWithCallback(t *testing.T) { @@ -407,7 +407,7 @@ func TestAnalyzer_ParamsAsMapWithCallback(t *testing.T) { m := make(map[string]spec.Parameter) e := []string{} pi, ok := s.spec.Paths.Paths["/fixture"] - require.True(t, ok) + require.TrueT(t, ok) pi.Parameters = pi.Get.Parameters s.paramsAsMap(pi.Parameters, m, func(_ spec.Parameter, err error) bool { @@ -416,14 +416,14 @@ func TestAnalyzer_ParamsAsMapWithCallback(t *testing.T) { return true // Continue }) - assert.Contains(t, strings.Join(e, ","), `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) - assert.Contains(t, strings.Join(e, ","), `invalid reference: "#/definitions/sample_info/properties/sids"`) + assert.StringContainsT(t, strings.Join(e, ","), `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) + assert.StringContainsT(t, strings.Join(e, ","), `invalid reference: "#/definitions/sample_info/properties/sids"`) // bail out callback m = make(map[string]spec.Parameter) e = []string{} pi, ok = s.spec.Paths.Paths["/fixture"] - require.True(t, ok) + require.TrueT(t, ok) pi.Parameters = pi.Get.Parameters s.paramsAsMap(pi.Parameters, m, func(_ spec.Parameter, err error) bool { @@ -443,7 +443,7 @@ func TestAnalyzer_ParamsAsMapWithCallback(t *testing.T) { m = make(map[string]spec.Parameter) e = []string{} pi, ok = s.spec.Paths.Paths["/fixture"] - require.True(t, ok) + require.TrueT(t, ok) pi.Parameters = pi.Get.Parameters s.paramsAsMap(pi.Parameters, m, func(_ spec.Parameter, err error) bool { @@ -462,7 +462,7 @@ func TestAnalyzer_ParamsAsMapWithCallback(t *testing.T) { m = make(map[string]spec.Parameter) e = []string{} pi, ok = s.spec.Paths.Paths["/fixture"] - require.True(t, ok) + require.TrueT(t, ok) pi.Parameters = pi.Get.Parameters s.paramsAsMap(pi.Parameters, m, func(_ spec.Parameter, err error) bool { @@ -509,7 +509,7 @@ func TestAnalyzer_SafeParamsFor(t *testing.T) { e := []string{} pi, ok := s.spec.Paths.Paths["/fixture"] - require.True(t, ok) + require.TrueT(t, ok) pi.Parameters = pi.Get.Parameters @@ -523,8 +523,8 @@ func TestAnalyzer_SafeParamsFor(t *testing.T) { require.Fail(t, "There should be no safe parameter in this testcase") } - assert.Contains(t, strings.Join(e, ","), `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) - assert.Contains(t, strings.Join(e, ","), `invalid reference: "#/definitions/sample_info/properties/sids"`) + assert.StringContainsT(t, strings.Join(e, ","), `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) + assert.StringContainsT(t, strings.Join(e, ","), `invalid reference: "#/definitions/sample_info/properties/sids"`) } func TestAnalyzer_ParamsFor(t *testing.T) { @@ -558,7 +558,7 @@ func TestAnalyzer_SafeParametersFor(t *testing.T) { e := []string{} pi, ok := s.spec.Paths.Paths["/fixture"] - require.True(t, ok) + require.TrueT(t, ok) errFunc := func(_ spec.Parameter, err error) bool { e = append(e, err.Error()) @@ -571,8 +571,8 @@ func TestAnalyzer_SafeParametersFor(t *testing.T) { require.Fail(t, "There should be no safe parameter in this testcase") } - assert.Contains(t, strings.Join(e, ","), `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) - assert.Contains(t, strings.Join(e, ","), `invalid reference: "#/definitions/sample_info/properties/sids"`) + assert.StringContainsT(t, strings.Join(e, ","), `resolved reference is not a parameter: "#/definitions/sample_info/properties/sid"`) + assert.StringContainsT(t, strings.Join(e, ","), `invalid reference: "#/definitions/sample_info/properties/sids"`) } func TestAnalyzer_ParametersFor(t *testing.T) { @@ -609,14 +609,14 @@ func TestAnalyzer_SecurityDefinitionsFor(t *testing.T) { pi2 := spec.spec.Paths.Paths["/items"].Get defs1 := spec.SecurityDefinitionsFor(pi1) - require.Contains(t, defs1, "oauth2") - require.Contains(t, defs1, "basic") - require.NotContains(t, defs1, "apiKey") + require.MapContainsT(t, defs1, "oauth2") + require.MapContainsT(t, defs1, "basic") + require.MapNotContainsT(t, defs1, "apiKey") defs2 := spec.SecurityDefinitionsFor(pi2) - require.Contains(t, defs2, "oauth2") - require.Contains(t, defs2, "basic") - require.Contains(t, defs2, "apiKey") + require.MapContainsT(t, defs2, "oauth2") + require.MapContainsT(t, defs2, "basic") + require.MapContainsT(t, defs2, "apiKey") } func TestAnalyzer_SecurityRequirements(t *testing.T) { @@ -630,16 +630,16 @@ func TestAnalyzer_SecurityRequirements(t *testing.T) { reqs1 := spec.SecurityRequirementsFor(pi1) require.Len(t, reqs1, 2) require.Len(t, reqs1[0], 1) - require.Equal(t, "oauth2", reqs1[0][0].Name) + require.EqualT(t, "oauth2", reqs1[0][0].Name) require.Equal(t, reqs1[0][0].Scopes, scopes) require.Len(t, reqs1[1], 1) - require.Equal(t, "basic", reqs1[1][0].Name) + require.EqualT(t, "basic", reqs1[1][0].Name) require.Empty(t, reqs1[1][0].Scopes) reqs2 := spec.SecurityRequirementsFor(pi2) require.Len(t, reqs2, 3) require.Len(t, reqs2[0], 1) - require.Equal(t, "oauth2", reqs2[0][0].Name) + require.EqualT(t, "oauth2", reqs2[0][0].Name) require.Equal(t, scopes, reqs2[0][0].Scopes) require.Len(t, reqs2[1], 1) require.Empty(t, reqs2[1][0].Name) @@ -660,25 +660,25 @@ func TestAnalyzer_SecurityRequirementsDefinitions(t *testing.T) { reqs1 := spec.SecurityRequirementsFor(pi1) defs11 := spec.SecurityDefinitionsForRequirements(reqs1[0]) - require.Contains(t, defs11, "oauth2") + require.MapContainsT(t, defs11, "oauth2") defs12 := spec.SecurityDefinitionsForRequirements(reqs1[1]) - require.Contains(t, defs12, "basic") - require.NotContains(t, defs12, "apiKey") + require.MapContainsT(t, defs12, "basic") + require.MapNotContainsT(t, defs12, "apiKey") reqs2 := spec.SecurityRequirementsFor(pi2) defs21 := spec.SecurityDefinitionsForRequirements(reqs2[0]) require.Len(t, defs21, 1) - require.Contains(t, defs21, "oauth2") - require.NotContains(t, defs21, "basic") - require.NotContains(t, defs21, "apiKey") + require.MapContainsT(t, defs21, "oauth2") + require.MapNotContainsT(t, defs21, "basic") + require.MapNotContainsT(t, defs21, "apiKey") defs22 := spec.SecurityDefinitionsForRequirements(reqs2[1]) require.NotNil(t, defs22) require.Empty(t, defs22) defs23 := spec.SecurityDefinitionsForRequirements(reqs2[2]) require.Len(t, defs23, 2) - require.NotContains(t, defs23, "oauth2") - require.Contains(t, defs23, "basic") - require.Contains(t, defs23, "apiKey") + require.MapNotContainsT(t, defs23, "oauth2") + require.MapContainsT(t, defs23, "basic") + require.MapContainsT(t, defs23, "apiKey") } func TestAnalyzer_MoreParamAnalysis(t *testing.T) { @@ -728,10 +728,10 @@ func TestAnalyzer_MoreParamAnalysis(t *testing.T) { assert.Lenf(t, schemaRefs, 1, "Expected 1 schema with AllOf definition in this spec") method, path, op, found := an.OperationForName("postSomeWhere") - assert.Equal(t, "POST", method) - assert.Equal(t, "/some/where", path) + assert.EqualT(t, "POST", method) + assert.EqualT(t, "/some/where", path) require.NotNil(t, op) - require.True(t, found) + require.TrueT(t, found) sec := an.SecurityRequirementsFor(op) assert.Nil(t, sec) @@ -745,16 +745,16 @@ func TestAnalyzer_MoreParamAnalysis(t *testing.T) { assert.Empty(t, method) assert.Empty(t, path) assert.Nil(t, op) - assert.False(t, found) + assert.FalseT(t, found) // does not take ops under pathItem $ref ops := an.OperationMethodPaths() assert.Lenf(t, ops, 3, "Expected 3 ops") ops = an.OperationIDs() assert.Lenf(t, ops, 3, "Expected 3 ops") - assert.Contains(t, ops, "postSomeWhere") - assert.Contains(t, ops, "GET /some/where/else") - assert.Contains(t, ops, "GET /some/where") + assert.SliceContainsT(t, ops, "postSomeWhere") + assert.SliceContainsT(t, ops, "GET /some/where/else") + assert.SliceContainsT(t, ops, "GET /some/where") } func TestAnalyzer_EdgeCases(t *testing.T) { @@ -886,25 +886,25 @@ func makeFixturepec(pi, pi2 spec.PathItem, formatParam *spec.Parameter) *spec.Sw } func assertEnum(t testing.TB, data map[string][]any, key string, enum []any) { - require.Contains(t, data, key) + require.MapContainsT(t, data, key) assert.Equal(t, enum, data[key]) } func assertRefExists(t testing.TB, data map[string]spec.Ref, key string) bool { _, ok := data[key] - return assert.Truef(t, ok, "expected %q to exist in the ref bag", key) + return assert.TrueTf(t, ok, "expected %q to exist in the ref bag", key) } func assertSchemaRefExists(t testing.TB, data map[string]SchemaRef, key string) bool { _, ok := data[key] - return assert.Truef(t, ok, "expected %q to exist in schema ref bag", key) + return assert.TrueTf(t, ok, "expected %q to exist in schema ref bag", key) } func assertPattern(t testing.TB, data map[string]string, key, pattern string) bool { - if assert.Contains(t, data, key) { - return assert.Equal(t, pattern, data[key]) + if assert.MapContainsT(t, data, key) { + return assert.EqualT(t, pattern, data[key]) } return false diff --git a/doc.go b/doc.go index 9d41371..9c4b165 100644 --- a/doc.go +++ b/doc.go @@ -1,32 +1,31 @@ // SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers // SPDX-License-Identifier: Apache-2.0 -/* -Package analysis provides methods to work with a Swagger specification document from -package go-openapi/spec. - -## Analyzing a specification - -An analysed specification object (type Spec) provides methods to work with swagger definition. - -## Flattening or expanding a specification - -Flattening a specification bundles all remote $ref in the main spec document. -Depending on flattening options, additional preprocessing may take place: - - full flattening: replacing all inline complex constructs by a named entry in #/definitions - - expand: replace all $ref's in the document by their expanded content - -## Merging several specifications - -Mixin several specifications merges all Swagger constructs, and warns about found conflicts. - -## Fixing a specification - -Unmarshalling a specification with golang json unmarshalling may lead to -some unwanted result on present but empty fields. - -## Analyzing a Swagger schema - -Swagger schemas are analyzed to determine their complexity and qualify their content. -*/ +// Package analysis provides methods to work with a Swagger specification document from +// package go-openapi/spec. +// +// # Analyzing a specification +// +// An analysed specification object (type Spec) provides methods to work with swagger definition. +// +// # Flattening or expanding a specification +// +// Flattening a specification bundles all remote $ref in the main spec document. +// Depending on flattening options, additional preprocessing may take place: +// +// - full flattening: replacing all inline complex constructs by a named entry in #/definitions +// - expand: replace all $ref's in the document by their expanded content +// +// # Merging several specifications +// +// [Mixin] several specifications merges all Swagger constructs, and warns about found conflicts. +// +// # Fixing a specification +// +// Unmarshalling a specification with golang [json] unmarshalling may lead to +// some unwanted result on present but empty fields. +// +// # Analyzing a Swagger schema +// +// Swagger schemas are analyzed to determine their complexity and qualify their content. package analysis diff --git a/fixer_test.go b/fixer_test.go index 658343f..3eaae12 100644 --- a/fixer_test.go +++ b/fixer_test.go @@ -36,7 +36,7 @@ func TestFixer_EmptyResponseDescriptions(t *testing.T) { for r, toPin := range sp.Responses { resp := toPin - assert.Truef(t, assertResponse(t, "/responses/"+r, &resp, true), + assert.TrueTf(t, assertResponse(t, "/responses/"+r, &resp, true), "expected a fixed empty description in response %s", r) } } @@ -50,13 +50,13 @@ func assertAllVerbs(t testing.TB, pathItem spec.PathItem, isEmpty bool) { mode = "an unmodified" } - assert.Truef(t, assertResponseInOperation(t, pathItem.Get, isEmpty), msg, mode, "GET") - assert.Truef(t, assertResponseInOperation(t, pathItem.Put, isEmpty), msg, mode, "PUT") - assert.Truef(t, assertResponseInOperation(t, pathItem.Post, isEmpty), msg, mode, "POST") - assert.Truef(t, assertResponseInOperation(t, pathItem.Delete, isEmpty), msg, mode, "DELETE") - assert.Truef(t, assertResponseInOperation(t, pathItem.Options, isEmpty), msg, mode, "OPTIONS") - assert.Truef(t, assertResponseInOperation(t, pathItem.Patch, isEmpty), msg, mode, "PATCH") - assert.Truef(t, assertResponseInOperation(t, pathItem.Head, isEmpty), msg, mode, "HEAD") + assert.TrueTf(t, assertResponseInOperation(t, pathItem.Get, isEmpty), msg, mode, "GET") + assert.TrueTf(t, assertResponseInOperation(t, pathItem.Put, isEmpty), msg, mode, "PUT") + assert.TrueTf(t, assertResponseInOperation(t, pathItem.Post, isEmpty), msg, mode, "POST") + assert.TrueTf(t, assertResponseInOperation(t, pathItem.Delete, isEmpty), msg, mode, "DELETE") + assert.TrueTf(t, assertResponseInOperation(t, pathItem.Options, isEmpty), msg, mode, "OPTIONS") + assert.TrueTf(t, assertResponseInOperation(t, pathItem.Patch, isEmpty), msg, mode, "PATCH") + assert.TrueTf(t, assertResponseInOperation(t, pathItem.Head, isEmpty), msg, mode, "HEAD") } func assertResponseInOperation(t testing.TB, op *spec.Operation, isEmpty bool) bool { @@ -67,14 +67,14 @@ func assertResponseInOperation(t testing.TB, op *spec.Operation, isEmpty bool) b } if op.Responses.Default != nil { - return assert.Truef(t, assertResponse(t, "default", op.Responses.Default, isEmpty), + return assert.TrueTf(t, assertResponse(t, "default", op.Responses.Default, isEmpty), "unexpected description in response %s for operation", "default") } for code, resp := range op.Responses.StatusCodeResponses { pin := resp - return assert.Truef(t, assertResponse(t, strconv.Itoa(code), &pin, isEmpty), + return assert.TrueTf(t, assertResponse(t, strconv.Itoa(code), &pin, isEmpty), "unexpected description in response %d for operation", code) } @@ -94,7 +94,7 @@ func assertResponse(t testing.TB, path string, resp *spec.Response, isEmpty bool expected = "" } - if !assert.Equalf(t, expected, resp.Description, "unexpected description for resp. %s", path) { + if !assert.EqualTf(t, expected, resp.Description, "unexpected description for resp. %s", path) { return false } diff --git a/flatten.go b/flatten.go index e225b71..17cc4ad 100644 --- a/flatten.go +++ b/flatten.go @@ -52,13 +52,15 @@ func newContext() *context { // There is a minimal and a full flattening mode. // // Minimally flattening a spec means: +// // - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left // unscathed) -// - Importing external (http, file) references so they become internal to the document +// - Importing external ([http], file) references so they become internal to the document // - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers // like "$ref": "#/definitions/myObject/allOfs/1") // // A minimally flattened spec thus guarantees the following properties: +// // - all $refs point to a local definition (i.e. '#/definitions/...') // - definitions are unique // @@ -70,6 +72,7 @@ func newContext() *context { // Minimal flattening is necessary and sufficient for codegen rendering using go-swagger. // // Fully flattening a spec means: +// // - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. // // By complex, we mean every JSON object with some properties. @@ -80,6 +83,7 @@ func newContext() *context { // have been created. // // Available flattening options: +// // - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched // - Expand: expand all $ref's in the document (inoperant if Minimal set to true) // - Verbose: croaks about name conflicts detected @@ -87,8 +91,9 @@ func newContext() *context { // // NOTE: expansion removes all $ref save circular $ref, which remain in place // -// TODO: additional options -// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a +// Desirable future additions: additional options. +// +// - PropagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a // x-go-name extension // - LiftAllOfs: // - limit the flattening of allOf members when simple objects diff --git a/flatten_name_test.go b/flatten_name_test.go index 592a936..93039e5 100644 --- a/flatten_name_test.go +++ b/flatten_name_test.go @@ -31,7 +31,7 @@ func TestName_FromRef(t *testing.T) { } for _, v := range values { - assert.Equal(t, v.Expected, nameFromRef(spec.MustCreateRef(v.Source), &FlattenOpts{})) + assert.EqualT(t, v.Expected, nameFromRef(spec.MustCreateRef(v.Source), &FlattenOpts{})) } } @@ -50,8 +50,8 @@ func TestName_FromRefMangle(t *testing.T) { } for _, v := range values { - assert.Equal(t, v.Expected, nameFromRef(spec.MustCreateRef(v.Source), &FlattenOpts{})) - assert.Equal(t, v.ExpectedKeepName, nameFromRef(spec.MustCreateRef(v.Source), &FlattenOpts{KeepNames: true})) + assert.EqualT(t, v.Expected, nameFromRef(spec.MustCreateRef(v.Source), &FlattenOpts{})) + assert.EqualT(t, v.ExpectedKeepName, nameFromRef(spec.MustCreateRef(v.Source), &FlattenOpts{KeepNames: true})) } } @@ -73,7 +73,7 @@ func TestName_Definition(t *testing.T) { for _, v := range values { u, _ := uniqifyName(v.Definitions, nameFromRef(spec.MustCreateRef(v.Source), &FlattenOpts{})) - assert.Equal(t, v.Expected, u) + assert.EqualT(t, v.Expected, u) } } @@ -187,53 +187,53 @@ func TestName_SplitKey(t *testing.T) { parts := sortref.KeyParts(v.Key) pref := parts.PathRef() piref := parts.PathItemRef() - assert.Equal(t, v.PathRef.String(), pref.String(), "pathRef: %s at %d", v.Key, i) - assert.Equal(t, v.PathItemRef.String(), piref.String(), "pathItemRef: %s at %d", v.Key, i) + assert.EqualT(t, v.PathRef.String(), pref.String(), "pathRef: %s at %d", v.Key, i) + assert.EqualT(t, v.PathItemRef.String(), piref.String(), "pathItemRef: %s at %d", v.Key, i) if v.Flags&isOperation != 0 { - assert.True(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i) + assert.TrueT(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i) } else { - assert.False(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i) + assert.FalseT(t, parts.IsOperation(), "isOperation: %s at %d", v.Key, i) } if v.Flags&isDefinition != 0 { - assert.True(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i) - assert.Equal(t, v.Name, parts.DefinitionName(), "definition name: %s at %d", v.Key, i) + assert.TrueT(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i) + assert.EqualT(t, v.Name, parts.DefinitionName(), "definition name: %s at %d", v.Key, i) } else { - assert.False(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i) + assert.FalseT(t, parts.IsDefinition(), "isDefinition: %s at %d", v.Key, i) if v.Name != "" { - assert.Equal(t, v.Name, parts.ResponseName(), "response name: %s at %d", v.Key, i) + assert.EqualT(t, v.Name, parts.ResponseName(), "response name: %s at %d", v.Key, i) } } if v.Flags&isOperationParam != 0 { - assert.True(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i) + assert.TrueT(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i) } else { - assert.False(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i) + assert.FalseT(t, parts.IsOperationParam(), "isOperationParam: %s at %d", v.Key, i) } if v.Flags&isSharedOperationParam != 0 { - assert.True(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i) + assert.TrueT(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i) } else { - assert.False(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i) + assert.FalseT(t, parts.IsSharedOperationParam(), "isSharedOperationParam: %s at %d", v.Key, i) } if v.Flags&isOperationResponse != 0 { - assert.True(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i) + assert.TrueT(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i) } else { - assert.False(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i) + assert.FalseT(t, parts.IsOperationResponse(), "isOperationResponse: %s at %d", v.Key, i) } if v.Flags&isDefaultResponse != 0 { - assert.True(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i) + assert.TrueT(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i) } else { - assert.False(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i) + assert.FalseT(t, parts.IsDefaultResponse(), "isDefaultResponse: %s at %d", v.Key, i) } if v.Flags&isStatusCodeResponse != 0 { - assert.True(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i) + assert.TrueT(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i) } else { - assert.False(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i) + assert.FalseT(t, parts.IsStatusCodeResponse(), "isStatusCodeResponse: %s at %d", v.Key, i) } } } @@ -292,14 +292,14 @@ func TestName_BuildNameWithReservedKeyWord(t *testing.T) { startIdx := 2 segments := []string{"fullview"} newName := s.BuildName(segments, startIdx, partAdder(nil)) - assert.Equal(t, "fullview properties", newName) + assert.EqualT(t, "fullview properties", newName) s = sortref.SplitKey([]string{ "definitions", "fullview", "properties", "properties", "properties", "properties", "properties", "properties", }) newName = s.BuildName(segments, startIdx, partAdder(nil)) - assert.Equal(t, "fullview"+strings.Repeat(" properties", 3), newName) + assert.EqualT(t, "fullview"+strings.Repeat(" properties", 3), newName) } func TestName_InlinedSchemas(t *testing.T) { @@ -483,21 +483,21 @@ func TestName_InlinedSchemas(t *testing.T) { switch tv := vv.(type) { case *spec.Schema: - assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case spec.Schema: - assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrBool: var sRef spec.Ref if tv != nil && tv.Schema != nil { sRef = tv.Schema.Ref } - assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrArray: var sRef spec.Ref if tv != nil && tv.Schema != nil { sRef = tv.Schema.Ref } - assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) default: assert.Fail(t, "unknown type", "got %T", vv) } diff --git a/flatten_options.go b/flatten_options.go index a9e54a8..23a57ea 100644 --- a/flatten_options.go +++ b/flatten_options.go @@ -35,7 +35,7 @@ type FlattenOpts struct { _ struct{} // require keys } -// ExpandOpts creates a spec.ExpandOptions to configure expanding a specification document. +// ExpandOpts creates a spec.[spec.ExpandOptions] to configure expanding a specification document. func (f *FlattenOpts) ExpandOpts(skipSchemas bool) *spec.ExpandOptions { return &spec.ExpandOptions{ RelativeBase: f.BasePath, diff --git a/flatten_test.go b/flatten_test.go index cb10b95..96f5fb7 100644 --- a/flatten_test.go +++ b/flatten_test.go @@ -75,9 +75,9 @@ func TestFlatten_ImportExternalReferences(t *testing.T) { require.NoError(t, erx) require.Len(t, sp.Definitions, 11) - require.Contains(t, sp.Definitions, "tag") - require.Contains(t, sp.Definitions, "named") - require.Contains(t, sp.Definitions, "record") + require.MapContainsT(t, sp.Definitions, "tag") + require.MapContainsT(t, sp.Definitions, "named") + require.MapContainsT(t, sp.Definitions, "record") for idx, toPin := range makeRefFixtures() { i := idx @@ -95,16 +95,16 @@ func TestFlatten_ImportExternalReferences(t *testing.T) { switch tv := vv.(type) { case *spec.Schema: - require.Equal(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key) + require.EqualT(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key) case spec.Schema: - require.Equal(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key) + require.EqualT(t, v.Ref.String(), tv.Ref.String(), "for %s", v.Key) case *spec.SchemaOrBool: - require.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key) + require.EqualT(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key) case *spec.SchemaOrArray: - require.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key) + require.EqualT(t, v.Ref.String(), tv.Schema.Ref.String(), "for %s", v.Key) default: require.Fail(t, "unknown type", "got %T", vv) @@ -113,12 +113,10 @@ func TestFlatten_ImportExternalReferences(t *testing.T) { } // check the complete result for clarity - jazon := antest.AsJSON(t, sp) - expected, err := os.ReadFile(filepath.Join("fixtures", "expected", "external-references-1.json")) require.NoError(t, err) - assert.JSONEq(t, string(expected), jazon) + assert.JSONMarshalAsT(t, string(expected), sp) // iterate again: this time all external schema $ref's should be reinlined opts.Spec.reload() @@ -131,7 +129,7 @@ func TestFlatten_ImportExternalReferences(t *testing.T) { opts.Spec.reload() for _, ref := range opts.Spec.references.schemas { - require.True(t, ref.HasFragmentOnly) + require.TrueT(t, ref.HasFragmentOnly) } // now try complete flatten, with unused definitions removed @@ -140,12 +138,10 @@ func TestFlatten_ImportExternalReferences(t *testing.T) { require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: true})) - jazon = antest.AsJSON(t, an.spec) - expected, err = os.ReadFile(filepath.Join("fixtures", "expected", "external-references-2.json")) require.NoError(t, err) - assert.JSONEq(t, string(expected), jazon) + assert.JSONMarshalAsT(t, string(expected), an.spec) } func makeFlattenFixtures() []refFixture { @@ -352,24 +348,24 @@ func TestFlatten_CheckRef(t *testing.T) { switch s := d.(type) { case *spec.Schema: - assert.Equal(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key) case spec.Schema: - assert.Equal(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), s.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrArray: var sRef spec.Ref if s != nil && s.Schema != nil { sRef = s.Schema.Ref } - assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrBool: var sRef spec.Ref if s != nil && s.Schema != nil { sRef = s.Schema.Ref } - assert.Equal(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), sRef.String(), "at %d for %s", i, v.Key) default: assert.Fail(t, "unknown type", "got %T at %d for %s", d, i, v.Key) @@ -388,37 +384,37 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { })) res := getInPath(t, sp, "/some/where", "/get/responses/204/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/uniqueName1"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/uniqueName1"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/204/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/d"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/d"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/206/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/a"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/a"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/304/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/transitive11"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/transitive11"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/205/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/b"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/b"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/200/schema") - assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/default/schema") // pointer expanded - assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "a") - assert.JSONEqf(t, + assert.JSONEqTf(t, `{"type": "object", "properties": { "a": { "$ref": "#/definitions/aAOAIGen" }}}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "aA") - assert.JSONEqf(t, `{"type": "string", "format": "date"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "string", "format": "date"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "aAOAIGen") - assert.JSONEqf(t, ` + assert.JSONEqTf(t, ` { "type": "object", "properties": { @@ -431,13 +427,13 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "bB") - assert.JSONEqf(t, `{"type": "string", "format": "date-time"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "string", "format": "date-time"}`, res, "Expected a simple schema for response") _, ok := sp.Definitions["bItems"] - assert.Falsef(t, ok, "Did not expect a definition for %s", "bItems") + assert.FalseTf(t, ok, "Did not expect a definition for %s", "bItems") res = getDefinition(t, sp, "d") - assert.JSONEqf(t, ` + assert.JSONEqTf(t, ` { "type": "object", "properties": { @@ -449,7 +445,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "b") - assert.JSONEqf(t, ` + assert.JSONEqTf(t, ` { "type": "array", "items": { @@ -459,7 +455,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { `, res, "Expected a ref in response") res = getDefinition(t, sp, "myBody") - assert.JSONEqf(t, ` + assert.JSONEqTf(t, ` { "type": "object", "properties": { @@ -474,10 +470,10 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "uniqueName2") - assert.JSONEqf(t, `{"$ref": "#/definitions/notUniqueName2"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/notUniqueName2"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "notUniqueName2") - assert.JSONEqf(t, ` + assert.JSONEqTf(t, ` { "type": "object", "properties": { @@ -489,7 +485,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { `, res, "Expected a simple schema for response") res = getDefinition(t, sp, "uniqueName1") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "object", "properties": { "prop5": { @@ -498,7 +494,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { // allOf container: []spec.Schema res = getDefinition(t, sp, "getWithSliceContainerDefaultBody") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "allOf": [ { "$ref": "#/definitions/uniqueName3" @@ -511,7 +507,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "getWithSliceContainerDefaultBodyAllOf1") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "object", "properties": { "prop8": { @@ -522,7 +518,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "getWithTupleContainerDefaultBody") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "array", "items": [ { @@ -537,7 +533,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { // with container SchemaOrArray res = getDefinition(t, sp, "getWithTupleConflictDefaultBody") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "array", "items": [ { @@ -551,7 +547,7 @@ func TestFlatten_FullWithOAIGen(t *testing.T) { }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "getWithTupleConflictDefaultBodyItems1") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "object", "properties": { "prop10": { @@ -580,41 +576,41 @@ func TestFlatten_MinimalWithOAIGen(t *testing.T) { require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) msg := logCapture.String() - if !assert.NotContainsf(t, msg, + if !assert.StringNotContainsTf(t, msg, "warning: duplicate flattened definition name resolved as aAOAIGen", "Expected log message") { t.Logf("Captured log: %s", msg) } - if !assert.NotContainsf(t, msg, + if !assert.StringNotContainsTf(t, msg, "warning: duplicate flattened definition name resolved as uniqueName2OAIGen", "Expected log message") { t.Logf("Captured log: %s", msg) } res := getInPath(t, sp, "/some/where", "/get/responses/204/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/uniqueName1"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/uniqueName1"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/204/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/d"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/d"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/206/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/a"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/a"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/304/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/transitive11"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/transitive11"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/get/responses/205/schema") - assert.JSONEqf(t, `{"$ref": "#/definitions/b"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/b"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/200/schema") - assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where", "/post/responses/default/schema") // This JSON pointer is expanded - assert.JSONEqf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "integer"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "aA") - assert.JSONEqf(t, `{"type": "string", "format": "date"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "string", "format": "date"}`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "a") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "object", "properties": { "a": { @@ -629,13 +625,13 @@ func TestFlatten_MinimalWithOAIGen(t *testing.T) { }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "bB") - assert.JSONEqf(t, `{"type": "string", "format": "date-time"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"type": "string", "format": "date-time"}`, res, "Expected a simple schema for response") _, ok := sp.Definitions["bItems"] - assert.Falsef(t, ok, "Did not expect a definition for %s", "bItems") + assert.FalseTf(t, ok, "Did not expect a definition for %s", "bItems") res = getDefinition(t, sp, "d") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "object", "properties": { "c": { @@ -645,7 +641,7 @@ func TestFlatten_MinimalWithOAIGen(t *testing.T) { }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "b") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "array", "items": { "$ref": "#/definitions/d" @@ -653,7 +649,7 @@ func TestFlatten_MinimalWithOAIGen(t *testing.T) { }`, res, "Expected a ref in response") res = getDefinition(t, sp, "myBody") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "object", "properties": { "aA": { @@ -666,11 +662,11 @@ func TestFlatten_MinimalWithOAIGen(t *testing.T) { }`, res, "Expected a simple schema for response") res = getDefinition(t, sp, "uniqueName2") - assert.JSONEqf(t, `{"$ref": "#/definitions/notUniqueName2"}`, res, "Expected a simple schema for response") + assert.JSONEqTf(t, `{"$ref": "#/definitions/notUniqueName2"}`, res, "Expected a simple schema for response") // with allOf container: []spec.Schema res = getInPath(t, sp, "/with/slice/container", "/get/responses/default/schema") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "allOf": [ { "$ref": "#/definitions/uniqueName3" @@ -683,7 +679,7 @@ func TestFlatten_MinimalWithOAIGen(t *testing.T) { // with tuple container res = getInPath(t, sp, "/with/tuple/container", "/get/responses/default/schema") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "array", "items": [ { @@ -697,7 +693,7 @@ func TestFlatten_MinimalWithOAIGen(t *testing.T) { // with SchemaOrArray container res = getInPath(t, sp, "/with/tuple/conflict", "/get/responses/default/schema") - assert.JSONEqf(t, `{ + assert.JSONEqTf(t, `{ "type": "array", "items": [ { @@ -727,10 +723,10 @@ func assertNoOAIGen(t *testing.T, bp string, sp *spec.Swagger) (success bool) { require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) msg := logCapture.String() - assert.NotContains(t, msg, "warning") + assert.StringNotContainsT(t, msg, "warning") for k := range sp.Definitions { - require.NotContains(t, k, "OAIGen") + require.StringNotContainsT(t, k, "OAIGen") } return @@ -748,7 +744,7 @@ func TestFlatten_OAIGen(t *testing.T) { bp := filepath.Join("fixtures", "oaigen", "test3-swagger.yaml") sp := antest.LoadOrFail(t, bp) - require.Truef(t, assertNoOAIGen(t, bp, sp), "did not expect an OAIGen definition here") + require.TrueTf(t, assertNoOAIGen(t, bp, sp), "did not expect an OAIGen definition here") }) } } @@ -760,7 +756,7 @@ func TestMoreNameInlinedSchemas(t *testing.T) { require.NoError(t, Flatten(FlattenOpts{Spec: New(sp), BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) res := getInPath(t, sp, "/some/where/{id}", "/post/responses/200/schema") - assert.JSONEqf(t, ` + assert.JSONEqTf(t, ` { "type": "object", "additionalProperties": { @@ -775,7 +771,7 @@ func TestMoreNameInlinedSchemas(t *testing.T) { res, "Expected a simple schema for response") res = getInPath(t, sp, "/some/where/{id}", "/post/responses/204/schema") - assert.JSONEqf(t, ` + assert.JSONEqTf(t, ` { "type": "object", "additionalProperties": { @@ -822,17 +818,17 @@ func TestRemoveUnused(t *testing.T) { assert.Nil(t, sp.Responses) op, ok := an.OperationFor("GET", "/some/where") - assert.True(t, ok) + assert.TrueT(t, ok) assert.Lenf(t, op.Parameters, 4, "Expected 4 parameters expanded for this operation") assert.Lenf(t, an.ParamsFor("GET", "/some/where"), 7, "Expected 7 parameters (with default) expanded for this operation") op, ok = an.OperationFor("PATCH", "/some/remote") - assert.True(t, ok) + assert.TrueT(t, ok) assert.Lenf(t, op.Parameters, 1, "Expected 1 parameter expanded for this operation") assert.Lenf(t, an.ParamsFor("PATCH", "/some/remote"), 2, "Expected 2 parameters (with default) expanded for this operation") _, ok = sp.Definitions["unused"] - assert.False(t, ok, "Did not expect to find #/definitions/unused") + assert.FalseT(t, ok, "Did not expect to find #/definitions/unused") bp = filepath.Join("fixtures", "parameters", "fixture-parameters.yaml") sp = antest.LoadOrFail(t, bp) @@ -842,7 +838,7 @@ func TestRemoveUnused(t *testing.T) { assert.Nil(t, sp.Parameters) assert.Nil(t, sp.Responses) _, ok = sp.Definitions["unused"] - assert.Falsef(t, ok, "Did not expect to find #/definitions/unused") + assert.FalseTf(t, ok, "Did not expect to find #/definitions/unused") } func TestOperationIDs(t *testing.T) { @@ -855,43 +851,43 @@ func TestOperationIDs(t *testing.T) { t.Run("should GatherOperations", func(t *testing.T) { res := operations.GatherOperations(New(sp), []string{"getSomeWhere", "getSomeWhereElse"}) - assert.Containsf(t, res, "getSomeWhere", "expected to find operation") - assert.Containsf(t, res, "getSomeWhereElse", "expected to find operation") - assert.NotContainsf(t, res, "postSomeWhere", "did not expect to find operation") + assert.MapContainsTf(t, res, "getSomeWhere", "expected to find operation") + assert.MapContainsTf(t, res, "getSomeWhereElse", "expected to find operation") + assert.MapNotContainsTf(t, res, "postSomeWhere", "did not expect to find operation") }) op, ok := an.OperationFor("GET", "/some/where/else") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("getSomeWhereElse"), 2) op, ok = an.OperationFor("POST", "/some/where/else") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("postSomeWhereElse"), 1) op, ok = an.OperationFor("PUT", "/some/where/else") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("putSomeWhereElse"), 1) op, ok = an.OperationFor("PATCH", "/some/where/else") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("patchSomeWhereElse"), 1) op, ok = an.OperationFor("DELETE", "/some/where/else") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("deleteSomeWhereElse"), 1) op, ok = an.OperationFor("HEAD", "/some/where/else") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("headSomeWhereElse"), 1) op, ok = an.OperationFor("OPTIONS", "/some/where/else") - assert.True(t, ok) + assert.TrueT(t, ok) assert.NotNil(t, op) assert.Len(t, an.ParametersFor("optionsSomeWhereElse"), 1) @@ -911,7 +907,7 @@ func TestFlatten_Pointers(t *testing.T) { // re-analyse and check all $ref's point to #/definitions bn := New(sp) for _, r := range bn.AllRefs() { - assert.Equal(t, definitionsPath, path.Dir(r.String())) + assert.EqualT(t, definitionsPath, path.Dir(r.String())) } } @@ -978,9 +974,9 @@ func TestFlatten_Bitbucket(t *testing.T) { assert.Len(t, sp.Definitions, 2) // only 2 remaining refs after expansion: circular $ref _, ok := sp.Definitions["base_commit"] - assert.True(t, ok) + assert.TrueT(t, ok) _, ok = sp.Definitions["repository"] - assert.True(t, ok) + assert.TrueT(t, ok) } func TestFlatten_Issue_1602(t *testing.T) { @@ -1064,8 +1060,8 @@ func TestFlatten_Issue_1614(t *testing.T) { // check that responses subject to warning have been expanded jazon := antest.AsJSON(t, sp) - assert.NotContains(t, jazon, `#/responses/forbidden`) - assert.NotContains(t, jazon, `#/responses/empty`) + assert.StringNotContainsT(t, jazon, `#/responses/forbidden`) + assert.StringNotContainsT(t, jazon, `#/responses/empty`) } func TestFlatten_Issue_1621(t *testing.T) { @@ -1083,16 +1079,13 @@ func TestFlatten_Issue_1621(t *testing.T) { })) sch1 := sp.Paths.Paths["/v4/users/"].Get.Responses.StatusCodeResponses[200].Schema - jazon := antest.AsJSON(t, sch1) - assert.JSONEq(t, `{"type": "array", "items": {"$ref": "#/definitions/v4UserListItem" }}`, jazon) + assert.JSONMarshalAsT(t, `{"type": "array", "items": {"$ref": "#/definitions/v4UserListItem" }}`, sch1) sch2 := sp.Paths.Paths["/v4/user/"].Get.Responses.StatusCodeResponses[200].Schema - jazon = antest.AsJSON(t, sch2) - assert.JSONEq(t, `{"$ref": "#/definitions/v4UserListItem"}`, jazon) + assert.JSONMarshalAsT(t, `{"$ref": "#/definitions/v4UserListItem"}`, sch2) sch3 := sp.Paths.Paths["/v4/users/{email}/"].Get.Responses.StatusCodeResponses[200].Schema - jazon = antest.AsJSON(t, sch3) - assert.JSONEq(t, `{"$ref": "#/definitions/v4UserListItem"}`, jazon) + assert.JSONMarshalAsT(t, `{"$ref": "#/definitions/v4UserListItem"}`, sch3) } func TestFlatten_Issue_1796(t *testing.T) { @@ -1109,7 +1102,7 @@ func TestFlatten_Issue_1796(t *testing.T) { // assert all $ref match "$ref": "#/definitions/something" for _, ref := range an.AllReferences() { - assert.True(t, strings.HasPrefix(ref, "#/definitions")) + assert.TrueT(t, strings.HasPrefix(ref, "#/definitions")) } } @@ -1126,7 +1119,7 @@ func TestFlatten_Issue_1767(t *testing.T) { // assert all $ref match "$ref": "#/definitions/something" for _, ref := range an.AllReferences() { - assert.True(t, strings.HasPrefix(ref, "#/definitions")) + assert.TrueT(t, strings.HasPrefix(ref, "#/definitions")) } } @@ -1145,7 +1138,7 @@ func TestFlatten_Issue_1774(t *testing.T) { // assert all $ref match "$ref": "#/definitions/something" for _, ref := range an.AllReferences() { - assert.True(t, strings.HasPrefix(ref, "#/definitions")) + assert.TrueT(t, strings.HasPrefix(ref, "#/definitions")) } } @@ -1177,19 +1170,16 @@ func TestFlatten_1851(t *testing.T) { })) serverDefinition, ok := an.spec.Definitions["server"] - assert.True(t, ok) + assert.TrueT(t, ok) serverStatusDefinition, ok := an.spec.Definitions["serverStatus"] - assert.True(t, ok) + assert.TrueT(t, ok) serverStatusProperty, ok := serverDefinition.Properties["Status"] - assert.True(t, ok) - - jazon := antest.AsJSON(t, serverStatusProperty) - assert.JSONEq(t, `{"$ref": "#/definitions/serverStatus"}`, jazon) + assert.TrueT(t, ok) - jazon = antest.AsJSON(t, serverStatusDefinition) - assert.JSONEq(t, `{"type": "string", "enum": [ "OK", "Not OK" ]}`, jazon) + assert.JSONMarshalAsT(t, `{"$ref": "#/definitions/serverStatus"}`, serverStatusProperty) + assert.JSONMarshalAsT(t, `{"type": "string", "enum": [ "OK", "Not OK" ]}`, serverStatusDefinition) // additional test case: this one used to work bp = filepath.Join("fixtures", "bugs", "1851", "fixture-1851-2.yaml") @@ -1199,19 +1189,16 @@ func TestFlatten_1851(t *testing.T) { require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) serverDefinition, ok = an.spec.Definitions["Server"] - assert.True(t, ok) + assert.TrueT(t, ok) serverStatusDefinition, ok = an.spec.Definitions["ServerStatus"] - assert.True(t, ok) + assert.TrueT(t, ok) serverStatusProperty, ok = serverDefinition.Properties["Status"] - assert.True(t, ok) + assert.TrueT(t, ok) - jazon = antest.AsJSON(t, serverStatusProperty) - assert.JSONEq(t, `{"$ref": "#/definitions/ServerStatus"}`, jazon) - - jazon = antest.AsJSON(t, serverStatusDefinition) - assert.JSONEq(t, `{"type": "string", "enum": [ "OK", "Not OK" ]}`, jazon) + assert.JSONMarshalAsT(t, `{"$ref": "#/definitions/ServerStatus"}`, serverStatusProperty) + assert.JSONMarshalAsT(t, `{"type": "string", "enum": [ "OK", "Not OK" ]}`, serverStatusDefinition) } func TestFlatten_RemoteAbsolute(t *testing.T) { @@ -1255,7 +1242,7 @@ func TestFlatten_2092(t *testing.T) { firstJSONMinimal := antest.AsJSON(t, an.spec) // verify we don't have dangling oaigen refs - require.Falsef(t, rexOAIGen.MatchString(firstJSONMinimal), "unmatched regexp for: %s", firstJSONMinimal) + require.FalseTf(t, rexOAIGen.MatchString(firstJSONMinimal), "unmatched regexp for: %s", firstJSONMinimal) sp = antest.LoadOrFail(t, bp) an = New(sp) @@ -1263,7 +1250,7 @@ func TestFlatten_2092(t *testing.T) { firstJSONFull := antest.AsJSON(t, an.spec) // verify we don't have dangling oaigen refs - require.Falsef(t, rexOAIGen.MatchString(firstJSONFull), "unmatched regexp for: %s", firstJSONFull) + require.FalseTf(t, rexOAIGen.MatchString(firstJSONFull), "unmatched regexp for: %s", firstJSONFull) for i := range 10 { t.Run(fmt.Sprintf("issue_2092_%d", i), func(t *testing.T) { @@ -1276,7 +1263,7 @@ func TestFlatten_2092(t *testing.T) { require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: false})) jazon := antest.AsJSON(t, an.spec) - assert.JSONEq(t, firstJSONMinimal, jazon) + assert.JSONEqT(t, firstJSONMinimal, jazon) require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: true, RemoveUnused: true})) @@ -1286,7 +1273,7 @@ func TestFlatten_2092(t *testing.T) { require.NoError(t, Flatten(FlattenOpts{Spec: an, BasePath: bp, Verbose: true, Minimal: false, RemoveUnused: false})) jazon = antest.AsJSON(t, an.spec) - assert.JSONEq(t, firstJSONFull, jazon) + assert.JSONEqT(t, firstJSONFull, jazon) }) } } @@ -1315,12 +1302,10 @@ func TestFlatten_2113(t *testing.T) { RemoveUnused: false, })) - jazon := antest.AsJSON(t, sp) - expected, err := os.ReadFile(filepath.Join("fixtures", "expected", "issue-2113.json")) require.NoError(t, err) - require.JSONEq(t, string(expected), jazon) + assert.JSONMarshalAsT(t, string(expected), sp) } func TestFlatten_2334(t *testing.T) { @@ -1342,9 +1327,9 @@ func TestFlatten_2334(t *testing.T) { jazon := antest.AsJSON(t, sp) - assert.Contains(t, jazon, `"$ref": "#/definitions/Bar"`) - assert.Contains(t, jazon, `"Bar":`) - assert.Contains(t, jazon, `"Baz":`) + assert.StringContainsT(t, jazon, `"$ref": "#/definitions/Bar"`) + assert.StringContainsT(t, jazon, `"Bar":`) + assert.StringContainsT(t, jazon, `"Baz":`) } func TestFlatten_1898(t *testing.T) { @@ -1361,17 +1346,17 @@ func TestFlatten_1898(t *testing.T) { RemoveUnused: false, })) op, ok := an.OperationFor("GET", "/example/v2/GetEvents") - require.True(t, ok) + require.TrueT(t, ok) resp, _, ok := op.SuccessResponse() - require.True(t, ok) + require.TrueT(t, ok) - require.Equal(t, "#/definitions/xStreamDefinitionsV2EventMsg", resp.Schema.Ref.String()) + require.EqualT(t, "#/definitions/xStreamDefinitionsV2EventMsg", resp.Schema.Ref.String()) def, ok := sp.Definitions["xStreamDefinitionsV2EventMsg"] - require.True(t, ok) + require.TrueT(t, ok) require.Len(t, def.Properties, 2) - require.Contains(t, def.Properties, "error") - require.Contains(t, def.Properties, "result") + require.MapContainsT(t, def.Properties, "error") + require.MapContainsT(t, def.Properties, "result") } func TestFlatten_RemoveUnused_2657(t *testing.T) { @@ -1422,7 +1407,7 @@ func TestFlatten_Relative_2743(t *testing.T) { func getDefinition(t testing.TB, sp *spec.Swagger, key string) string { d, ok := sp.Definitions[key] - require.Truef(t, ok, "Expected definition for %s", key) + require.TrueTf(t, ok, "Expected definition for %s", key) res, err := json.Marshal(d) if err != nil { panic(err) @@ -1454,7 +1439,7 @@ func checkRefs(t testing.TB, spec *spec.Swagger, expectNoConflict bool) { for _, matched := range m { subMatch := matched[1] - assert.True(t, strings.HasPrefix(subMatch, "#/definitions/"), + assert.TrueT(t, strings.HasPrefix(subMatch, "#/definitions/"), "expected $ref to be inlined, got: %s", matched[0]) } diff --git a/go.mod b/go.mod index c004741..367839d 100644 --- a/go.mod +++ b/go.mod @@ -1,23 +1,23 @@ module github.com/go-openapi/analysis require ( - github.com/go-openapi/jsonpointer v0.22.4 - github.com/go-openapi/spec v0.22.3 + github.com/go-openapi/jsonpointer v0.22.5 + github.com/go-openapi/spec v0.22.4 github.com/go-openapi/strfmt v0.25.0 - github.com/go-openapi/swag/jsonutils v0.25.4 - github.com/go-openapi/swag/loading v0.25.4 + github.com/go-openapi/swag/jsonutils v0.25.5 + github.com/go-openapi/swag/loading v0.25.5 github.com/go-openapi/swag/mangling v0.25.4 github.com/go-openapi/testify/v2 v2.4.0 ) require ( github.com/go-openapi/errors v0.22.5 // indirect - github.com/go-openapi/jsonreference v0.21.4 // indirect - github.com/go-openapi/swag/conv v0.25.4 // indirect - github.com/go-openapi/swag/jsonname v0.25.4 // indirect - github.com/go-openapi/swag/stringutils v0.25.4 // indirect - github.com/go-openapi/swag/typeutils v0.25.4 // indirect - github.com/go-openapi/swag/yamlutils v0.25.4 // indirect + github.com/go-openapi/jsonreference v0.21.5 // indirect + github.com/go-openapi/swag/conv v0.25.5 // indirect + github.com/go-openapi/swag/jsonname v0.25.5 // indirect + github.com/go-openapi/swag/stringutils v0.25.5 // indirect + github.com/go-openapi/swag/typeutils v0.25.5 // indirect + github.com/go-openapi/swag/yamlutils v0.25.5 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/oklog/ulid v1.3.1 // indirect diff --git a/go.sum b/go.sum index 4c51785..75f40ce 100644 --- a/go.sum +++ b/go.sum @@ -2,34 +2,23 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-openapi/errors v0.22.5 h1:Yfv4O/PRYpNF3BNmVkEizcHb3uLVVsrDt3LNdgAKRY4= github.com/go-openapi/errors v0.22.5/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk= -github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4= -github.com/go-openapi/jsonpointer v0.22.4/go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80= -github.com/go-openapi/jsonreference v0.21.4 h1:24qaE2y9bx/q3uRK/qN+TDwbok1NhbSmGjjySRCHtC8= -github.com/go-openapi/jsonreference v0.21.4/go.mod h1:rIENPTjDbLpzQmQWCj5kKj3ZlmEh+EFVbz3RTUh30/4= -github.com/go-openapi/spec v0.22.3 h1:qRSmj6Smz2rEBxMnLRBMeBWxbbOvuOoElvSvObIgwQc= -github.com/go-openapi/spec v0.22.3/go.mod h1:iIImLODL2loCh3Vnox8TY2YWYJZjMAKYyLH2Mu8lOZs= +github.com/go-openapi/jsonpointer v0.22.5 h1:8on/0Yp4uTb9f4XvTrM2+1CPrV05QPZXu+rvu2o9jcA= +github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= +github.com/go-openapi/spec v0.22.4 h1:4pxGjipMKu0FzFiu/DPwN3CTBRlVM2yLf/YTWorYfDQ= github.com/go-openapi/strfmt v0.25.0 h1:7R0RX7mbKLa9EYCTHRcCuIPcaqlyQiWNPTXwClK0saQ= github.com/go-openapi/strfmt v0.25.0/go.mod h1:nNXct7OzbwrMY9+5tLX4I21pzcmE6ccMGXl3jFdPfn8= -github.com/go-openapi/swag/conv v0.25.4 h1:/Dd7p0LZXczgUcC/Ikm1+YqVzkEeCc9LnOWjfkpkfe4= -github.com/go-openapi/swag/conv v0.25.4/go.mod h1:3LXfie/lwoAv0NHoEuY1hjoFAYkvlqI/Bn5EQDD3PPU= -github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI= -github.com/go-openapi/swag/jsonname v0.25.4/go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag= -github.com/go-openapi/swag/jsonutils v0.25.4 h1:VSchfbGhD4UTf4vCdR2F4TLBdLwHyUDTd1/q4i+jGZA= -github.com/go-openapi/swag/jsonutils v0.25.4/go.mod h1:7OYGXpvVFPn4PpaSdPHJBtF0iGnbEaTk8AvBkoWnaAY= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4 h1:IACsSvBhiNJwlDix7wq39SS2Fh7lUOCJRmx/4SN4sVo= -github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.4/go.mod h1:Mt0Ost9l3cUzVv4OEZG+WSeoHwjWLnarzMePNDAOBiM= -github.com/go-openapi/swag/loading v0.25.4 h1:jN4MvLj0X6yhCDduRsxDDw1aHe+ZWoLjW+9ZQWIKn2s= -github.com/go-openapi/swag/loading v0.25.4/go.mod h1:rpUM1ZiyEP9+mNLIQUdMiD7dCETXvkkC30z53i+ftTE= +github.com/go-openapi/swag/conv v0.25.5 h1:wAXBYEXJjoKwE5+vc9YHhpQOFj2JYBMF2DUi+tGu97g= +github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3US3uUYSFhSo= +github.com/go-openapi/swag/jsonutils v0.25.5 h1:XUZF8awQr75MXeC+/iaw5usY/iM7nXPDwdG3Jbl9vYo= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5 h1:SX6sE4FrGb4sEnnxbFL/25yZBb5Hcg1inLeErd86Y1U= +github.com/go-openapi/swag/loading v0.25.5 h1:odQ/umlIZ1ZVRteI6ckSrvP6e2w9UTF5qgNdemJHjuU= github.com/go-openapi/swag/mangling v0.25.4 h1:2b9kBJk9JvPgxr36V23FxJLdwBrpijI26Bx5JH4Hp48= github.com/go-openapi/swag/mangling v0.25.4/go.mod h1:6dxwu6QyORHpIIApsdZgb6wBk/DPU15MdyYj/ikn0Hg= -github.com/go-openapi/swag/stringutils v0.25.4 h1:O6dU1Rd8bej4HPA3/CLPciNBBDwZj9HiEpdVsb8B5A8= -github.com/go-openapi/swag/stringutils v0.25.4/go.mod h1:GTsRvhJW5xM5gkgiFe0fV3PUlFm0dr8vki6/VSRaZK0= -github.com/go-openapi/swag/typeutils v0.25.4 h1:1/fbZOUN472NTc39zpa+YGHn3jzHWhv42wAJSN91wRw= -github.com/go-openapi/swag/typeutils v0.25.4/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE= -github.com/go-openapi/swag/yamlutils v0.25.4 h1:6jdaeSItEUb7ioS9lFoCZ65Cne1/RZtPBZ9A56h92Sw= -github.com/go-openapi/swag/yamlutils v0.25.4/go.mod h1:MNzq1ulQu+yd8Kl7wPOut/YHAAU/H6hL91fF+E2RFwc= -github.com/go-openapi/testify/enable/yaml/v2 v2.0.2 h1:0+Y41Pz1NkbTHz8NngxTuAXxEodtNSI1WG1c/m5Akw4= -github.com/go-openapi/testify/enable/yaml/v2 v2.0.2/go.mod h1:kme83333GCtJQHXQ8UKX3IBZu6z8T5Dvy5+CW3NLUUg= +github.com/go-openapi/swag/stringutils v0.25.5 h1:NVkoDOA8YBgtAR/zvCx5rhJKtZF3IzXcDdwOsYzrB6M= +github.com/go-openapi/swag/typeutils v0.25.5 h1:EFJ+PCga2HfHGdo8s8VJXEVbeXRCYwzzr9u4rJk7L7E= +github.com/go-openapi/swag/yamlutils v0.25.5 h1:kASCIS+oIeoc55j28T4o8KwlV2S4ZLPT6G0iq2SSbVQ= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.0 h1:7SgOMTvJkM8yWrQlU8Jm18VeDPuAvB/xWrdxFJkoFag= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.0/go.mod h1:14iV8jyyQlinc9StD7w1xVPW3CO3q1Gj04Jy//Kw4VM= github.com/go-openapi/testify/v2 v2.4.0 h1:8nsPrHVCWkQ4p8h1EsRVymA2XABB4OT40gcvAu+voFM= github.com/go-openapi/testify/v2 v2.4.0/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= diff --git a/go.work b/go.work new file mode 100644 index 0000000..1794cfc --- /dev/null +++ b/go.work @@ -0,0 +1,6 @@ +go 1.24.0 + +use ( + . + ./internal/testintegration +) diff --git a/go.work.sum b/go.work.sum new file mode 100644 index 0000000..db9d930 --- /dev/null +++ b/go.work.sum @@ -0,0 +1,13 @@ +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4= +github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM= +github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI= +golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc= +golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= +golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ= diff --git a/internal/antest/helpers.go b/internal/antest/helpers.go index 0b55da0..6e87100 100644 --- a/internal/antest/helpers.go +++ b/internal/antest/helpers.go @@ -48,7 +48,7 @@ func initPathLoader() { } } -// LoadSpec loads a json or a yaml spec. +// LoadSpec loads a [json] or a yaml spec. func LoadSpec(path string) (*spec.Swagger, error) { oncePathLoader.Do(initPathLoader) diff --git a/internal/antest/helpers_test.go b/internal/antest/helpers_test.go index 7358785..6440a6d 100644 --- a/internal/antest/helpers_test.go +++ b/internal/antest/helpers_test.go @@ -12,7 +12,7 @@ import ( func TestLongTestEnabled(t *testing.T) { t.Run("should be false by default", func(t *testing.T) { - require.False(t, LongTestsEnabled()) + require.FalseT(t, LongTestsEnabled()) }) } @@ -101,7 +101,7 @@ info: } require.NoError(t, - os.WriteFile(file, data, 0o600), + os.WriteFile(file, data, 0o600), //nolint:gosec // false positive on temp test dir: G703: Path traversal via taint analysis. ) return file, func() {} diff --git a/internal/debug/debug_test.go b/internal/debug/debug_test.go index 680e117..aeed19c 100644 --- a/internal/debug/debug_test.go +++ b/internal/debug/debug_test.go @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers // SPDX-License-Identifier: Apache-2.0 -package debug +package debug //nolint:revive // this package is called debug and there is no confusion with the standard library for that. import ( "os" @@ -32,10 +32,10 @@ func TestDebug(t *testing.T) { tmpFile.Close() tmpFileClosed = true - flushed, err := os.ReadFile(tmpName) + flushed, err := os.ReadFile(tmpName) //nolint:gosec // false positive on temp test dir: G703: Path traversal via taint analysis. require.NoError(t, err) - assert.Contains(t, string(flushed), "A debug: a string") + assert.StringContainsT(t, string(flushed), "A debug: a string") tmpEmptyFile, err := os.CreateTemp(folder, "debug-empty-test") require.NoError(t, err) @@ -53,7 +53,7 @@ func TestDebug(t *testing.T) { tmpEmptyFile.Close() tmpEmptyFileClosed = true - flushed, err = os.ReadFile(tmpEmpty) + flushed, err = os.ReadFile(tmpEmpty) //nolint:gosec // false positive on temp test dir: G703: Path traversal via taint analysis. require.NoError(t, err) assert.Empty(t, flushed) diff --git a/internal/flatten/normalize/normalize.go b/internal/flatten/normalize/normalize.go index c04b6b4..afeef20 100644 --- a/internal/flatten/normalize/normalize.go +++ b/internal/flatten/normalize/normalize.go @@ -17,8 +17,9 @@ import ( // NOTE: does not support JSONschema ID for $ref (we assume we are working with swagger specs here). // // NOTE(windows): -// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) -// * "/ in paths may appear as escape sequences. +// +// - refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) +// - "/ in paths may appear as escape sequences. func RebaseRef(baseRef string, ref string) string { baseRef, _ = url.PathUnescape(baseRef) ref, _ = url.PathUnescape(ref) @@ -69,8 +70,9 @@ func RebaseRef(baseRef string, ref string) string { // Path renders absolute path on remote file refs // // NOTE(windows): -// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) -// * "/ in paths may appear as escape sequences. +// +// - refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) +// - "/ in paths may appear as escape sequences. func Path(ref spec.Ref, basePath string) string { uri, _ := url.PathUnescape(ref.String()) if ref.HasFragmentOnly || filepath.IsAbs(uri) { diff --git a/internal/flatten/normalize/normalize_test.go b/internal/flatten/normalize/normalize_test.go index eb5b7c0..680147c 100644 --- a/internal/flatten/normalize/normalize_test.go +++ b/internal/flatten/normalize/normalize_test.go @@ -35,43 +35,43 @@ func TestNormalize_Path(t *testing.T) { } for _, v := range values { - assert.Equal(t, v.Expected, Path(spec.MustCreateRef(v.Source), wrapWindowsPath("/abs/to/spec/spec.json"))) + assert.EqualT(t, v.Expected, Path(spec.MustCreateRef(v.Source), wrapWindowsPath("/abs/to/spec/spec.json"))) } } func TestNormalize_RebaseRef(t *testing.T) { t.Parallel() - assert.Equal(t, definitionABC, RebaseRef(definitionBase, definitionABC)) - assert.Equal(t, definitionABC, RebaseRef("", definitionABC)) - assert.Equal(t, definitionABC, RebaseRef(".", definitionABC)) - assert.Equal(t, "otherfile"+definitionABC, RebaseRef("file"+definitionBase, "otherfile"+definitionABC)) - assert.Equal(t, + assert.EqualT(t, definitionABC, RebaseRef(definitionBase, definitionABC)) + assert.EqualT(t, definitionABC, RebaseRef("", definitionABC)) + assert.EqualT(t, definitionABC, RebaseRef(".", definitionABC)) + assert.EqualT(t, "otherfile"+definitionABC, RebaseRef("file"+definitionBase, "otherfile"+definitionABC)) + assert.EqualT(t, wrapWindowsPath("../otherfile")+definitionABC, RebaseRef(wrapWindowsPath("../file")+definitionBase, wrapWindowsPath("./otherfile")+definitionABC), ) - assert.Equal(t, + assert.EqualT(t, wrapWindowsPath("../otherfile")+definitionABC, RebaseRef(wrapWindowsPath("../file")+definitionBase, wrapWindowsPath("otherfile")+definitionABC), ) - assert.Equal(t, + assert.EqualT(t, wrapWindowsPath("local/remote/otherfile")+definitionABC, RebaseRef(wrapWindowsPath("local/file")+definitionBase, wrapWindowsPath("remote/otherfile")+definitionABC), ) - assert.Equal(t, + assert.EqualT(t, wrapWindowsPath("local/remote/otherfile.yaml"), RebaseRef(wrapWindowsPath("local/file.yaml"), wrapWindowsPath("remote/otherfile.yaml")), ) - assert.Equal(t, "file#/definitions/abc", RebaseRef("file#/definitions/base", definitionABC)) + assert.EqualT(t, "file#/definitions/abc", RebaseRef("file#/definitions/base", definitionABC)) // with remote - assert.Equal(t, exampleBase+definitionABC, RebaseRef(exampleBase, exampleBase+definitionABC)) - assert.Equal(t, exampleBase+definitionABC, RebaseRef(exampleBase, definitionABC)) - assert.Equal(t, exampleBase+"#/dir/definitions/abc", RebaseRef(exampleBase, "#/dir/definitions/abc")) - assert.Equal(t, exampleBase+"/dir/definitions/abc", RebaseRef(exampleBase+"/spec.yaml", "dir/definitions/abc")) - assert.Equal(t, exampleBase+"/dir/definitions/abc", RebaseRef(exampleBase+"/", "dir/definitions/abc")) - assert.Equal(t, "https://example.com/dir/definitions/abc", RebaseRef(exampleBase, "dir/definitions/abc")) + assert.EqualT(t, exampleBase+definitionABC, RebaseRef(exampleBase, exampleBase+definitionABC)) + assert.EqualT(t, exampleBase+definitionABC, RebaseRef(exampleBase, definitionABC)) + assert.EqualT(t, exampleBase+"#/dir/definitions/abc", RebaseRef(exampleBase, "#/dir/definitions/abc")) + assert.EqualT(t, exampleBase+"/dir/definitions/abc", RebaseRef(exampleBase+"/spec.yaml", "dir/definitions/abc")) + assert.EqualT(t, exampleBase+"/dir/definitions/abc", RebaseRef(exampleBase+"/", "dir/definitions/abc")) + assert.EqualT(t, "https://example.com/dir/definitions/abc", RebaseRef(exampleBase, "dir/definitions/abc")) } // wrapWindowsPath adapts path expectations for tests running on windows. diff --git a/internal/flatten/operations/operations_test.go b/internal/flatten/operations/operations_test.go index e0fb2c3..4da83bb 100644 --- a/internal/flatten/operations/operations_test.go +++ b/internal/flatten/operations/operations_test.go @@ -37,7 +37,7 @@ func TestGatherOperations(t *testing.T) { } res := GatherOperations(m, nil) - require.Contains(t, res, "GetPth1") + require.MapContainsT(t, res, "GetPth1") }) t.Run("should handle duplicate operation IDs (when spec validation is skipped)", func(_ *testing.T) { @@ -63,8 +63,8 @@ func TestGatherOperations(t *testing.T) { } res := GatherOperations(m, nil) - require.Contains(t, res, "id1") - require.NotContains(t, res, "GetPth1") - require.Contains(t, res, "PostPth2") + require.MapContainsT(t, res, "id1") + require.MapNotContainsT(t, res, "GetPth1") + require.MapContainsT(t, res, "PostPth2") }) } diff --git a/internal/flatten/replace/replace.go b/internal/flatten/replace/replace.go index e8365f3..b4c0fdd 100644 --- a/internal/flatten/replace/replace.go +++ b/internal/flatten/replace/replace.go @@ -328,7 +328,7 @@ func UpdateRefWithSchema(sp *spec.Swagger, key string, sch *spec.Schema) error { return nil } -// DeepestRefResult holds the results from DeepestRef analysis. +// DeepestRefResult holds the results from [DeepestRef] analysis. type DeepestRefResult struct { Ref spec.Ref Schema *spec.Schema @@ -336,12 +336,13 @@ type DeepestRefResult struct { } // DeepestRef finds the first definition ref, from a cascade of nested refs which are not definitions. +// // - if no definition is found, returns the deepest ref. // - pointers to external files are expanded // // NOTE: all external $ref's are assumed to be already expanded at this stage. // -//nolint:gocognit,cyclop,gocyclo // this is the most complex method in this package and we'll have to break it down some day +//nolint:gocognit,gocyclo,cyclop // definitely needs a refactoring, in a follow-up PR func DeepestRef(sp *spec.Swagger, opts *spec.ExpandOptions, ref spec.Ref) (*DeepestRefResult, error) { if !ref.HasFragmentOnly { // we found an external $ref, which is odd at this stage: diff --git a/internal/flatten/replace/replace_test.go b/internal/flatten/replace/replace_test.go index 3afa6c0..681e4aa 100644 --- a/internal/flatten/replace/replace_test.go +++ b/internal/flatten/replace/replace_test.go @@ -32,13 +32,13 @@ func TestUpdateRef(t *testing.T) { switch tv := vv.(type) { case *spec.Schema: - assert.Equal(t, v.Ref.String(), tv.Ref.String()) + assert.EqualT(t, v.Ref.String(), tv.Ref.String()) case spec.Schema: - assert.Equal(t, v.Ref.String(), tv.Ref.String()) + assert.EqualT(t, v.Ref.String(), tv.Ref.String()) case *spec.SchemaOrBool: - assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String()) + assert.EqualT(t, v.Ref.String(), tv.Schema.Ref.String()) case *spec.SchemaOrArray: - assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String()) + assert.EqualT(t, v.Ref.String(), tv.Schema.Ref.String()) default: assert.Fail(t, "unknown type", "got %T", vv) } @@ -63,13 +63,13 @@ func TestRewriteSchemaRef(t *testing.T) { switch tv := vv.(type) { case *spec.Schema: - assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case spec.Schema: - assert.Equal(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), tv.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrBool: - assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key) case *spec.SchemaOrArray: - assert.Equal(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key) + assert.EqualT(t, v.Ref.String(), tv.Schema.Ref.String(), "at %d for %s", i, v.Key) default: assert.Fail(t, "unknown type", "got %T", vv) } diff --git a/internal/flatten/schutils/flatten_schema_test.go b/internal/flatten/schutils/flatten_schema_test.go index 1053fcd..0145af5 100644 --- a/internal/flatten/schutils/flatten_schema_test.go +++ b/internal/flatten/schutils/flatten_schema_test.go @@ -16,7 +16,7 @@ func TestFlattenSchema_Save(t *testing.T) { sp := &spec.Swagger{} Save(sp, "theName", spec.StringProperty()) - assert.Contains(t, sp.Definitions, "theName") + assert.MapContainsT(t, sp.Definitions, "theName") saveNilSchema := func() { Save(sp, "ThisNilSchema", nil) diff --git a/internal/flatten/sortref/keys.go b/internal/flatten/sortref/keys.go index 7ab8e4e..363bb19 100644 --- a/internal/flatten/sortref/keys.go +++ b/internal/flatten/sortref/keys.go @@ -56,7 +56,7 @@ func (k Keys) Less(i, j int) bool { return k[i].Segments > k[j].Segments || (k[i].Segments == k[j].Segments && k[i].Key < k[j].Key) } -// KeyParts construct a SplitKey with all its /-separated segments decomposed. It is sortable. +// KeyParts construct a [SplitKey] with all its /-separated segments decomposed. It is sortable. func KeyParts(key string) SplitKey { var res []string for part := range strings.SplitSeq(key[1:], "/") { diff --git a/internal/flatten/sortref/keys_test.go b/internal/flatten/sortref/keys_test.go index 4774978..028b298 100644 --- a/internal/flatten/sortref/keys_test.go +++ b/internal/flatten/sortref/keys_test.go @@ -21,5 +21,5 @@ func TestName_UnitGuards(t *testing.T) { assert.Empty(t, res) b := parts.isKeyName(-1) - assert.False(t, b) + assert.FalseT(t, b) } diff --git a/analysis_test/doc_test.go b/internal/testintegration/doc_test.go similarity index 88% rename from analysis_test/doc_test.go rename to internal/testintegration/doc_test.go index 0974553..067a26b 100644 --- a/analysis_test/doc_test.go +++ b/internal/testintegration/doc_test.go @@ -5,6 +5,7 @@ package analysis_test import ( "fmt" + "path/filepath" "github.com/go-openapi/analysis" // This package "github.com/go-openapi/loads" // Spec loading @@ -12,7 +13,7 @@ import ( func ExampleSpec() { // Example with spec file in this repo - path := "../fixtures/flatten.yml" + path := filepath.Join("..", "..", "fixtures", "flatten.yml") doc, err := loads.Spec(path) // Load spec from file if err == nil { an := analysis.New(doc.Spec()) // Analyze spec @@ -25,7 +26,7 @@ func ExampleSpec() { func ExampleFlatten() { // Example with spec file in this repo - path := "../fixtures/flatten.yml" + path := filepath.Join("..", "..", "fixtures", "flatten.yml") doc, err := loads.Spec(path) // Load spec from file if err == nil { an := analysis.New(doc.Spec()) // Analyze spec diff --git a/fixtures/azure/applicationGateway.json b/internal/testintegration/fixtures/azure/applicationGateway.json similarity index 100% rename from fixtures/azure/applicationGateway.json rename to internal/testintegration/fixtures/azure/applicationGateway.json diff --git a/fixtures/azure/applicationSecurityGroup.json b/internal/testintegration/fixtures/azure/applicationSecurityGroup.json similarity index 100% rename from fixtures/azure/applicationSecurityGroup.json rename to internal/testintegration/fixtures/azure/applicationSecurityGroup.json diff --git a/fixtures/azure/examples/NetworkInterfaceCreate.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceCreate.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceCreate.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceCreate.json diff --git a/fixtures/azure/examples/NetworkInterfaceDelete.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceDelete.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceDelete.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceDelete.json diff --git a/fixtures/azure/examples/NetworkInterfaceEffectiveNSGList.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceEffectiveNSGList.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceEffectiveNSGList.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceEffectiveNSGList.json diff --git a/fixtures/azure/examples/NetworkInterfaceEffectiveRouteTableList.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceEffectiveRouteTableList.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceEffectiveRouteTableList.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceEffectiveRouteTableList.json diff --git a/fixtures/azure/examples/NetworkInterfaceGet.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceGet.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceGet.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceGet.json diff --git a/fixtures/azure/examples/NetworkInterfaceIPConfigurationGet.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceIPConfigurationGet.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceIPConfigurationGet.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceIPConfigurationGet.json diff --git a/fixtures/azure/examples/NetworkInterfaceIPConfigurationList.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceIPConfigurationList.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceIPConfigurationList.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceIPConfigurationList.json diff --git a/fixtures/azure/examples/NetworkInterfaceList.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceList.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceList.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceList.json diff --git a/fixtures/azure/examples/NetworkInterfaceListAll.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceListAll.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceListAll.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceListAll.json diff --git a/fixtures/azure/examples/NetworkInterfaceLoadBalancerList.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceLoadBalancerList.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceLoadBalancerList.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceLoadBalancerList.json diff --git a/fixtures/azure/examples/NetworkInterfaceTapConfigurationCreate.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationCreate.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceTapConfigurationCreate.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationCreate.json diff --git a/fixtures/azure/examples/NetworkInterfaceTapConfigurationDelete.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationDelete.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceTapConfigurationDelete.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationDelete.json diff --git a/fixtures/azure/examples/NetworkInterfaceTapConfigurationGet.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationGet.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceTapConfigurationGet.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationGet.json diff --git a/fixtures/azure/examples/NetworkInterfaceTapConfigurationList.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationList.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceTapConfigurationList.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceTapConfigurationList.json diff --git a/fixtures/azure/examples/NetworkInterfaceUpdateTags.json b/internal/testintegration/fixtures/azure/examples/NetworkInterfaceUpdateTags.json similarity index 100% rename from fixtures/azure/examples/NetworkInterfaceUpdateTags.json rename to internal/testintegration/fixtures/azure/examples/NetworkInterfaceUpdateTags.json diff --git a/fixtures/azure/examples/PublicIpAddressCreateCustomizedValues.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressCreateCustomizedValues.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressCreateCustomizedValues.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressCreateCustomizedValues.json diff --git a/fixtures/azure/examples/PublicIpAddressCreateDefaults.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressCreateDefaults.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressCreateDefaults.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressCreateDefaults.json diff --git a/fixtures/azure/examples/PublicIpAddressCreateDns.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressCreateDns.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressCreateDns.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressCreateDns.json diff --git a/fixtures/azure/examples/PublicIpAddressDelete.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressDelete.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressDelete.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressDelete.json diff --git a/fixtures/azure/examples/PublicIpAddressGet.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressGet.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressGet.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressGet.json diff --git a/fixtures/azure/examples/PublicIpAddressList.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressList.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressList.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressList.json diff --git a/fixtures/azure/examples/PublicIpAddressListAll.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressListAll.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressListAll.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressListAll.json diff --git a/fixtures/azure/examples/PublicIpAddressUpdateTags.json b/internal/testintegration/fixtures/azure/examples/PublicIpAddressUpdateTags.json similarity index 100% rename from fixtures/azure/examples/PublicIpAddressUpdateTags.json rename to internal/testintegration/fixtures/azure/examples/PublicIpAddressUpdateTags.json diff --git a/fixtures/azure/loadBalancer.json b/internal/testintegration/fixtures/azure/loadBalancer.json similarity index 100% rename from fixtures/azure/loadBalancer.json rename to internal/testintegration/fixtures/azure/loadBalancer.json diff --git a/fixtures/azure/network.json b/internal/testintegration/fixtures/azure/network.json similarity index 100% rename from fixtures/azure/network.json rename to internal/testintegration/fixtures/azure/network.json diff --git a/fixtures/azure/networkInterface.json b/internal/testintegration/fixtures/azure/networkInterface.json similarity index 100% rename from fixtures/azure/networkInterface.json rename to internal/testintegration/fixtures/azure/networkInterface.json diff --git a/fixtures/azure/networkProfile.json b/internal/testintegration/fixtures/azure/networkProfile.json similarity index 100% rename from fixtures/azure/networkProfile.json rename to internal/testintegration/fixtures/azure/networkProfile.json diff --git a/fixtures/azure/networkSecurityGroup.json b/internal/testintegration/fixtures/azure/networkSecurityGroup.json similarity index 100% rename from fixtures/azure/networkSecurityGroup.json rename to internal/testintegration/fixtures/azure/networkSecurityGroup.json diff --git a/fixtures/azure/networkWatcher.json b/internal/testintegration/fixtures/azure/networkWatcher.json similarity index 100% rename from fixtures/azure/networkWatcher.json rename to internal/testintegration/fixtures/azure/networkWatcher.json diff --git a/fixtures/azure/privateEndpoint.json b/internal/testintegration/fixtures/azure/privateEndpoint.json similarity index 100% rename from fixtures/azure/privateEndpoint.json rename to internal/testintegration/fixtures/azure/privateEndpoint.json diff --git a/fixtures/azure/privateLinkService.json b/internal/testintegration/fixtures/azure/privateLinkService.json similarity index 100% rename from fixtures/azure/privateLinkService.json rename to internal/testintegration/fixtures/azure/privateLinkService.json diff --git a/fixtures/azure/publicIpAddress.json b/internal/testintegration/fixtures/azure/publicIpAddress.json similarity index 100% rename from fixtures/azure/publicIpAddress.json rename to internal/testintegration/fixtures/azure/publicIpAddress.json diff --git a/fixtures/azure/routeTable.json b/internal/testintegration/fixtures/azure/routeTable.json similarity index 100% rename from fixtures/azure/routeTable.json rename to internal/testintegration/fixtures/azure/routeTable.json diff --git a/fixtures/azure/serviceEndpointPolicy.json b/internal/testintegration/fixtures/azure/serviceEndpointPolicy.json similarity index 100% rename from fixtures/azure/serviceEndpointPolicy.json rename to internal/testintegration/fixtures/azure/serviceEndpointPolicy.json diff --git a/fixtures/azure/virtualNetwork.json b/internal/testintegration/fixtures/azure/virtualNetwork.json similarity index 100% rename from fixtures/azure/virtualNetwork.json rename to internal/testintegration/fixtures/azure/virtualNetwork.json diff --git a/fixtures/azure/virtualNetworkTap.json b/internal/testintegration/fixtures/azure/virtualNetworkTap.json similarity index 100% rename from fixtures/azure/virtualNetworkTap.json rename to internal/testintegration/fixtures/azure/virtualNetworkTap.json diff --git a/internal/testintegration/go.mod b/internal/testintegration/go.mod new file mode 100644 index 0000000..59722d2 --- /dev/null +++ b/internal/testintegration/go.mod @@ -0,0 +1,34 @@ +module github.com/go-openapi/analysis/internal/testintegration + +go 1.24.0 + +require ( + github.com/go-openapi/analysis v0.24.2 + github.com/go-openapi/loads v0.23.2 + github.com/go-openapi/spec v0.22.4 + github.com/go-openapi/swag/loading v0.25.5 + github.com/go-openapi/testify/v2 v2.4.0 +) + +require ( + github.com/go-openapi/errors v0.22.5 // indirect + github.com/go-openapi/jsonpointer v0.22.5 // indirect + github.com/go-openapi/jsonreference v0.21.5 // indirect + github.com/go-openapi/strfmt v0.25.0 // indirect + github.com/go-openapi/swag/conv v0.25.5 // indirect + github.com/go-openapi/swag/jsonname v0.25.5 // indirect + github.com/go-openapi/swag/jsonutils v0.25.5 // indirect + github.com/go-openapi/swag/mangling v0.25.4 // indirect + github.com/go-openapi/swag/stringutils v0.25.5 // indirect + github.com/go-openapi/swag/typeutils v0.25.5 // indirect + github.com/go-openapi/swag/yamlutils v0.25.5 // indirect + github.com/go-viper/mapstructure/v2 v2.4.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/oklog/ulid v1.3.1 // indirect + go.mongodb.org/mongo-driver v1.17.6 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/net v0.48.0 // indirect + golang.org/x/text v0.32.0 // indirect +) + +replace github.com/go-openapi/analysis => ../.. diff --git a/internal/testintegration/go.sum b/internal/testintegration/go.sum new file mode 100644 index 0000000..f0c473d --- /dev/null +++ b/internal/testintegration/go.sum @@ -0,0 +1,54 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-openapi/errors v0.22.5 h1:Yfv4O/PRYpNF3BNmVkEizcHb3uLVVsrDt3LNdgAKRY4= +github.com/go-openapi/errors v0.22.5/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk= +github.com/go-openapi/jsonpointer v0.22.5 h1:8on/0Yp4uTb9f4XvTrM2+1CPrV05QPZXu+rvu2o9jcA= +github.com/go-openapi/jsonpointer v0.22.5/go.mod h1:gyUR3sCvGSWchA2sUBJGluYMbe1zazrYWIkWPjjMUY0= +github.com/go-openapi/jsonreference v0.21.5 h1:6uCGVXU/aNF13AQNggxfysJ+5ZcU4nEAe+pJyVWRdiE= +github.com/go-openapi/jsonreference v0.21.5/go.mod h1:u25Bw85sX4E2jzFodh1FOKMTZLcfifd1Q+iKKOUxExw= +github.com/go-openapi/loads v0.23.2 h1:rJXAcP7g1+lWyBHC7iTY+WAF0rprtM+pm8Jxv1uQJp4= +github.com/go-openapi/loads v0.23.2/go.mod h1:IEVw1GfRt/P2Pplkelxzj9BYFajiWOtY2nHZNj4UnWY= +github.com/go-openapi/spec v0.22.4 h1:4pxGjipMKu0FzFiu/DPwN3CTBRlVM2yLf/YTWorYfDQ= +github.com/go-openapi/spec v0.22.4/go.mod h1:WQ6Ai0VPWMZgMT4XySjlRIE6GP1bGQOtEThn3gcWLtQ= +github.com/go-openapi/strfmt v0.25.0 h1:7R0RX7mbKLa9EYCTHRcCuIPcaqlyQiWNPTXwClK0saQ= +github.com/go-openapi/strfmt v0.25.0/go.mod h1:nNXct7OzbwrMY9+5tLX4I21pzcmE6ccMGXl3jFdPfn8= +github.com/go-openapi/swag/conv v0.25.5 h1:wAXBYEXJjoKwE5+vc9YHhpQOFj2JYBMF2DUi+tGu97g= +github.com/go-openapi/swag/conv v0.25.5/go.mod h1:CuJ1eWvh1c4ORKx7unQnFGyvBbNlRKbnRyAvDvzWA4k= +github.com/go-openapi/swag/jsonname v0.25.5 h1:8p150i44rv/Drip4vWI3kGi9+4W9TdI3US3uUYSFhSo= +github.com/go-openapi/swag/jsonname v0.25.5/go.mod h1:jNqqikyiAK56uS7n8sLkdaNY/uq6+D2m2LANat09pKU= +github.com/go-openapi/swag/jsonutils v0.25.5 h1:XUZF8awQr75MXeC+/iaw5usY/iM7nXPDwdG3Jbl9vYo= +github.com/go-openapi/swag/jsonutils v0.25.5/go.mod h1:48FXUaz8YsDAA9s5AnaUvAmry1UcLcNVWUjY42XkrN4= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5 h1:SX6sE4FrGb4sEnnxbFL/25yZBb5Hcg1inLeErd86Y1U= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.5/go.mod h1:/2KvOTrKWjVA5Xli3DZWdMCZDzz3uV/T7bXwrKWPquo= +github.com/go-openapi/swag/loading v0.25.5 h1:odQ/umlIZ1ZVRteI6ckSrvP6e2w9UTF5qgNdemJHjuU= +github.com/go-openapi/swag/loading v0.25.5/go.mod h1:I8A8RaaQ4DApxhPSWLNYWh9NvmX2YKMoB9nwvv6oW6g= +github.com/go-openapi/swag/mangling v0.25.4 h1:2b9kBJk9JvPgxr36V23FxJLdwBrpijI26Bx5JH4Hp48= +github.com/go-openapi/swag/mangling v0.25.4/go.mod h1:6dxwu6QyORHpIIApsdZgb6wBk/DPU15MdyYj/ikn0Hg= +github.com/go-openapi/swag/stringutils v0.25.5 h1:NVkoDOA8YBgtAR/zvCx5rhJKtZF3IzXcDdwOsYzrB6M= +github.com/go-openapi/swag/stringutils v0.25.5/go.mod h1:PKK8EZdu4QJq8iezt17HM8RXnLAzY7gW0O1KKarrZII= +github.com/go-openapi/swag/typeutils v0.25.5 h1:EFJ+PCga2HfHGdo8s8VJXEVbeXRCYwzzr9u4rJk7L7E= +github.com/go-openapi/swag/typeutils v0.25.5/go.mod h1:itmFmScAYE1bSD8C4rS0W+0InZUBrB2xSPbWt6DLGuc= +github.com/go-openapi/swag/yamlutils v0.25.5 h1:kASCIS+oIeoc55j28T4o8KwlV2S4ZLPT6G0iq2SSbVQ= +github.com/go-openapi/swag/yamlutils v0.25.5/go.mod h1:Gek1/SjjfbYvM+Iq4QGwa/2lEXde9n2j4a3wI3pNuOQ= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.0 h1:7SgOMTvJkM8yWrQlU8Jm18VeDPuAvB/xWrdxFJkoFag= +github.com/go-openapi/testify/enable/yaml/v2 v2.4.0/go.mod h1:14iV8jyyQlinc9StD7w1xVPW3CO3q1Gj04Jy//Kw4VM= +github.com/go-openapi/testify/v2 v2.4.0 h1:8nsPrHVCWkQ4p8h1EsRVymA2XABB4OT40gcvAu+voFM= +github.com/go-openapi/testify/v2 v2.4.0/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54= +github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= +github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +go.mongodb.org/mongo-driver v1.17.6 h1:87JUG1wZfWsr6rIz3ZmpH90rL5tea7O3IHuSwHUpsss= +go.mongodb.org/mongo-driver v1.17.6/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= +golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= +golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/analysis_test/helpers_spec_test.go b/internal/testintegration/helpers_spec_test.go similarity index 86% rename from analysis_test/helpers_spec_test.go rename to internal/testintegration/helpers_spec_test.go index c972ce4..c3b771b 100644 --- a/analysis_test/helpers_spec_test.go +++ b/internal/testintegration/helpers_spec_test.go @@ -4,21 +4,19 @@ package analysis_test import ( - "encoding/json" "fmt" "regexp" "testing" + "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/spec" "github.com/go-openapi/testify/v2/assert" "github.com/go-openapi/testify/v2/require" ) -var ( - rex = regexp.MustCompile(`"\$ref":\s*"(.*?)"`) -) +var rex = regexp.MustCompile(`"\$ref":\s*"(.*?)"`) -func assertRefResolve(t *testing.T, jazon, exclude string, root interface{}, opts ...*spec.ExpandOptions) { +func assertRefResolve(t *testing.T, jazon, exclude string, root any, opts ...*spec.ExpandOptions) { assertRefWithFunc(t, "resolve", jazon, exclude, func(t *testing.T, match string) { ref := spec.MustCreateRef(match) var ( @@ -37,7 +35,7 @@ func assertRefResolve(t *testing.T, jazon, exclude string, root interface{}, opt }) } -// assertNoRef ensures that no $ref is remaining in json doc +// assertNoRef ensures that no $ref is remaining in json doc. func assertNoRef(t testing.TB, jazon string) { m := rex.FindAllStringSubmatch(jazon, -1) require.Nil(t, m) @@ -88,9 +86,6 @@ func assertRefWithFunc(t *testing.T, name, jazon, exclude string, asserter func( } } -func asJSON(t testing.TB, sp interface{}) string { - bbb, err := json.MarshalIndent(sp, "", " ") - require.NoError(t, err) - - return string(bbb) +func asJSON(t testing.TB, sp any) string { + return antest.AsJSON(t, sp) } diff --git a/analysis_test/spec_test.go b/internal/testintegration/spec_test.go similarity index 82% rename from analysis_test/spec_test.go rename to internal/testintegration/spec_test.go index 1e9f081..f5d22ea 100644 --- a/analysis_test/spec_test.go +++ b/internal/testintegration/spec_test.go @@ -4,14 +4,15 @@ package analysis_test import ( - "io/ioutil" + "embed" + "io/fs" "net/http" "net/http/httptest" "os" + "path/filepath" "testing" "github.com/go-openapi/analysis" - "github.com/go-openapi/analysis/internal/antest" "github.com/go-openapi/loads" "github.com/go-openapi/spec" "github.com/go-openapi/swag/loading" @@ -19,45 +20,35 @@ import ( "github.com/go-openapi/testify/v2/require" ) -func skipNotify(t *testing.T) { - t.Log("To enable this long running test, use -args -enable-long in your go test command line") -} +//go:embed all:fixtures +var fixtureAssets embed.FS func Test_FlattenAzure(t *testing.T) { - if !antest.LongTestsEnabled() { - skipNotify(t) - t.SkipNow() - } t.Parallel() - // Local copy of https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/network/resource-manager/Microsoft.Network/stable/2020-04-01/publicIpAddress.json - url := "../fixtures/azure/publicIpAddress.json" - byts, err := loading.LoadFromFileOrHTTP(url) + file, err := filepath.Abs(filepath.Join("fixtures", "azure", "publicIpAddress.json")) + require.NoError(t, err) + b, err := loading.LoadFromFileOrHTTP(file) assert.NoError(t, err) swagger := &spec.Swagger{} - require.NoError(t, swagger.UnmarshalJSON(byts)) + require.NoError(t, swagger.UnmarshalJSON(b)) analyzed := analysis.New(swagger) - require.NoError(t, analysis.Flatten(analysis.FlattenOpts{Spec: analyzed, Expand: true, BasePath: url})) + require.NoError(t, analysis.Flatten(analysis.FlattenOpts{Spec: analyzed, Expand: true, BasePath: file})) jazon := asJSON(t, swagger) assertRefInJSONRegexp(t, jazon, `^(#/definitions/)|(\./example)`) t.Run("resolve local $ref azure", func(t *testing.T) { - assertRefResolve(t, jazon, `\./example`, swagger, &spec.ExpandOptions{RelativeBase: url}) + assertRefResolve(t, jazon, `\./example`, swagger, &spec.ExpandOptions{RelativeBase: file}) }) } func TestRemoteFlattenAzure_Expand(t *testing.T) { - if !antest.LongTestsEnabled() { - skipNotify(t) - t.SkipNow() - } t.Parallel() - server := httptest.NewServer(http.FileServer(http.Dir("../fixtures/azure"))) - defer server.Close() + server := fixtureServer(t, "fixtures/azure") basePath := server.URL + "/publicIpAddress.json" @@ -76,15 +67,9 @@ func TestRemoteFlattenAzure_Expand(t *testing.T) { } func TestRemoteFlattenAzure_Flatten(t *testing.T) { - if !antest.LongTestsEnabled() { - skipNotify(t) - t.SkipNow() - } t.Parallel() - server := httptest.NewServer(http.FileServer(http.Dir("../fixtures/azure"))) - defer server.Close() - + server := fixtureServer(t, "fixtures/azure") basePath := server.URL + "/publicIpAddress.json" swagger, err := loads.Spec(basePath) @@ -130,9 +115,21 @@ func TestIssue66(t *testing.T) { }) } +func fixtureServer(t testing.TB, dir string) *httptest.Server { + t.Helper() + + sub, err := fs.Sub(fixtureAssets, filepath.ToSlash(dir)) + require.NoError(t, err) + + server := httptest.NewServer(http.FileServerFS(sub)) + t.Cleanup(server.Close) + + return server +} + func makeFileSpec(t testing.TB) (string, func()) { - file := "./openapi.yaml" - require.NoError(t, ioutil.WriteFile(file, fixtureIssue66(), 0600)) + file := filepath.Join(".", "openapi.yaml") + require.NoError(t, os.WriteFile(file, fixtureIssue66(), 0o600)) return file, func() { _ = os.Remove(file) diff --git a/mixin.go b/mixin.go index cc5c392..a7a9306 100644 --- a/mixin.go +++ b/mixin.go @@ -18,12 +18,13 @@ import ( // needed. // // The following parts of primary are subject to merge, filling empty details +// // - Info // - BasePath // - Host // - ExternalDocs // -// Consider calling FixEmptyResponseDescriptions() on the modified primary +// Consider calling [FixEmptyResponseDescriptions]() on the modified primary // if you read them from storage and they are valid to start with. // // Entries in "paths", "definitions", "parameters" and "responses" are @@ -39,7 +40,7 @@ import ( // etc). Ensure they are canonical if your downstream tools do // key normalization of any form. // -// Merging schemes (http, https), and consumers/producers do not account for +// Merging schemes ([http], https), and consumers/producers do not account for // collisions. func Mixin(primary *spec.Swagger, mixins ...*spec.Swagger) []string { skipped := make([]string, 0, len(mixins)) diff --git a/schema_test.go b/schema_test.go index 097b308..cbf0cc2 100644 --- a/schema_test.go +++ b/schema_test.go @@ -22,13 +22,13 @@ func TestSchemaAnalysis_KnownTypes(t *testing.T) { for i, v := range knownSchemas() { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsKnownType, "item at %d should be a known type", i) + assert.TrueTf(t, sch.IsKnownType, "item at %d should be a known type", i) } for i, v := range complexSchemas() { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Falsef(t, sch.IsKnownType, "item at %d should not be a known type", i) + assert.FalseTf(t, sch.IsKnownType, "item at %d should not be a known type", i) } serv := refServer() @@ -37,13 +37,13 @@ func TestSchemaAnalysis_KnownTypes(t *testing.T) { for i, ref := range knownRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: refSchema(ref)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsKnownType, "item at %d should be a known type", i) + assert.TrueTf(t, sch.IsKnownType, "item at %d should be a known type", i) } for i, ref := range complexRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: refSchema(ref)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Falsef(t, sch.IsKnownType, "item at %d should not be a known type", i) + assert.FalseTf(t, sch.IsKnownType, "item at %d should not be a known type", i) } } @@ -51,15 +51,15 @@ func TestSchemaAnalysis_Array(t *testing.T) { for i, v := range append(knownSchemas(), (&spec.Schema{}).Typed("array", "")) { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) - assert.Truef(t, sch.IsSimpleArray, "item at %d should be a simple array type", i) + assert.TrueTf(t, sch.IsArray, "item at %d should be an array type", i) + assert.TrueTf(t, sch.IsSimpleArray, "item at %d should be a simple array type", i) } for i, v := range complexSchemas() { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) - assert.Falsef(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i) + assert.TrueTf(t, sch.IsArray, "item at %d should be an array type", i) + assert.FalseTf(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i) } serv := refServer() @@ -68,16 +68,16 @@ func TestSchemaAnalysis_Array(t *testing.T) { for i, ref := range knownRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(refSchema(ref))}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) - assert.Truef(t, sch.IsSimpleArray, "item at %d should be a simple array type", i) + assert.TrueTf(t, sch.IsArray, "item at %d should be an array type", i) + assert.TrueTf(t, sch.IsSimpleArray, "item at %d should be a simple array type", i) } for i, ref := range complexRefs(serv.URL) { sch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(refSchema(ref))}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Falsef(t, sch.IsKnownType, "item at %d should not be a known type", i) - assert.Truef(t, sch.IsArray, "item at %d should be an array type", i) - assert.Falsef(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i) + assert.FalseTf(t, sch.IsKnownType, "item at %d should not be a known type", i) + assert.TrueTf(t, sch.IsArray, "item at %d should be an array type", i) + assert.FalseTf(t, sch.IsSimpleArray, "item at %d should not be a simple array type", i) } // edge case: unrestricted array (beyond Swagger) @@ -85,35 +85,35 @@ func TestSchemaAnalysis_Array(t *testing.T) { at.Items = nil sch, err := Schema(SchemaOpts{Schema: at}) require.NoError(t, err) - assert.True(t, sch.IsArray) - assert.False(t, sch.IsTuple) - assert.False(t, sch.IsKnownType) - assert.True(t, sch.IsSimpleSchema) + assert.TrueT(t, sch.IsArray) + assert.FalseT(t, sch.IsTuple) + assert.FalseT(t, sch.IsKnownType) + assert.TrueT(t, sch.IsSimpleSchema) // unrestricted array with explicit empty schema at = spec.ArrayProperty(nil) at.Items = &spec.SchemaOrArray{} sch, err = Schema(SchemaOpts{Schema: at}) require.NoError(t, err) - assert.True(t, sch.IsArray) - assert.False(t, sch.IsTuple) - assert.False(t, sch.IsKnownType) - assert.True(t, sch.IsSimpleSchema) + assert.TrueT(t, sch.IsArray) + assert.FalseT(t, sch.IsTuple) + assert.FalseT(t, sch.IsKnownType) + assert.TrueT(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_Map(t *testing.T) { for i, v := range append(knownSchemas(), spec.MapProperty(nil)) { sch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsMap, "item at %d should be a map type", i) - assert.Truef(t, sch.IsSimpleMap, "item at %d should be a simple map type", i) + assert.TrueTf(t, sch.IsMap, "item at %d should be a map type", i) + assert.TrueTf(t, sch.IsSimpleMap, "item at %d should be a simple map type", i) } for i, v := range complexSchemas() { sch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsMap, "item at %d should be a map type", i) - assert.Falsef(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i) + assert.TrueTf(t, sch.IsMap, "item at %d should be a map type", i) + assert.FalseTf(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i) } } @@ -122,9 +122,9 @@ func TestSchemaAnalysis_ExtendedObject(t *testing.T) { wex := spec.MapProperty(v).SetProperty("name", *spec.StringProperty()) sch, err := Schema(SchemaOpts{Schema: wex}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsExtendedObject, "item at %d should be an extended map object type", i) - assert.Falsef(t, sch.IsMap, "item at %d should not be a map type", i) - assert.Falsef(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i) + assert.TrueTf(t, sch.IsExtendedObject, "item at %d should be an extended map object type", i) + assert.FalseTf(t, sch.IsMap, "item at %d should not be a map type", i) + assert.FalseTf(t, sch.IsSimpleMap, "item at %d should not be a simple map type", i) } } @@ -135,20 +135,20 @@ func TestSchemaAnalysis_Tuple(t *testing.T) { sch, err := Schema(SchemaOpts{Schema: at}) require.NoError(t, err) - assert.True(t, sch.IsTuple) - assert.False(t, sch.IsTupleWithExtra) - assert.False(t, sch.IsKnownType) - assert.False(t, sch.IsSimpleSchema) + assert.TrueT(t, sch.IsTuple) + assert.FalseT(t, sch.IsTupleWithExtra) + assert.FalseT(t, sch.IsKnownType) + assert.FalseT(t, sch.IsSimpleSchema) // edge case: tuple with a single element at.Items = &spec.SchemaOrArray{} at.Items.Schemas = append(at.Items.Schemas, *spec.StringProperty()) sch, err = Schema(SchemaOpts{Schema: at}) require.NoError(t, err) - assert.True(t, sch.IsTuple) - assert.False(t, sch.IsTupleWithExtra) - assert.False(t, sch.IsKnownType) - assert.False(t, sch.IsSimpleSchema) + assert.TrueT(t, sch.IsTuple) + assert.FalseT(t, sch.IsTupleWithExtra) + assert.FalseT(t, sch.IsKnownType) + assert.FalseT(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_TupleWithExtra(t *testing.T) { @@ -160,10 +160,10 @@ func TestSchemaAnalysis_TupleWithExtra(t *testing.T) { sch, err := Schema(SchemaOpts{Schema: at}) require.NoError(t, err) - assert.False(t, sch.IsTuple) - assert.True(t, sch.IsTupleWithExtra) - assert.False(t, sch.IsKnownType) - assert.False(t, sch.IsSimpleSchema) + assert.FalseT(t, sch.IsTuple) + assert.TrueT(t, sch.IsTupleWithExtra) + assert.FalseT(t, sch.IsKnownType) + assert.FalseT(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_BaseType(t *testing.T) { @@ -171,30 +171,30 @@ func TestSchemaAnalysis_BaseType(t *testing.T) { sch, err := Schema(SchemaOpts{Schema: cl}) require.NoError(t, err) - assert.True(t, sch.IsBaseType) - assert.False(t, sch.IsKnownType) - assert.False(t, sch.IsSimpleSchema) + assert.TrueT(t, sch.IsBaseType) + assert.FalseT(t, sch.IsKnownType) + assert.FalseT(t, sch.IsSimpleSchema) } func TestSchemaAnalysis_SimpleSchema(t *testing.T) { for i, v := range append(knownSchemas(), spec.ArrayProperty(nil), spec.MapProperty(nil)) { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Truef(t, sch.IsSimpleSchema, "item at %d should be a simple schema", i) + assert.TrueTf(t, sch.IsSimpleSchema, "item at %d should be a simple schema", i) asch, err := Schema(SchemaOpts{Schema: spec.ArrayProperty(v)}) require.NoErrorf(t, err, "failed to analyze array schema at %d: %v", i, err) - assert.Truef(t, asch.IsSimpleSchema, "array item at %d should be a simple schema", i) + assert.TrueTf(t, asch.IsSimpleSchema, "array item at %d should be a simple schema", i) msch, err := Schema(SchemaOpts{Schema: spec.MapProperty(v)}) require.NoErrorf(t, err, "failed to analyze map schema at %d: %v", i, err) - assert.Truef(t, msch.IsSimpleSchema, "map item at %d should be a simple schema", i) + assert.TrueTf(t, msch.IsSimpleSchema, "map item at %d should be a simple schema", i) } for i, v := range complexSchemas() { sch, err := Schema(SchemaOpts{Schema: v}) require.NoErrorf(t, err, "failed to analyze schema at %d: %v", i, err) - assert.Falsef(t, sch.IsSimpleSchema, "item at %d should not be a simple schema", i) + assert.FalseTf(t, sch.IsSimpleSchema, "item at %d should not be a simple schema", i) } } From ffd84bdeb796b1177bd9b6163774616b850e9b83 Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Tue, 3 Mar 2026 14:49:13 +0100 Subject: [PATCH 2/4] fix: ensure deterministic OAIGen processing order in flatten Sort map keys before iterating over newRefs in stripOAIGen and stripOAIGenForRef to avoid non-deterministic behavior caused by Go 1.26's Swiss Tables map implementation. Also ensures spec analysis is refreshed before stripping OAIGen refs and propagates parent tracking when target refs are themselves OAIGen entries. Co-Authored-By: Felix Kollmann --- flatten.go | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/flatten.go b/flatten.go index 17cc4ad..d7ee006 100644 --- a/flatten.go +++ b/flatten.go @@ -496,14 +496,25 @@ func stripPointersAndOAIGen(opts *FlattenOpts) error { // pointer and name resolution again. func stripOAIGen(opts *FlattenOpts) (bool, error) { debugLog("stripOAIGen") + // Ensure the spec analysis is fresh, as previous steps (namePointers, etc.) might have modified refs. + opts.Spec.reload() + replacedWithComplex := false // figure out referers of OAIGen definitions (doing it before the ref start mutating) - for _, r := range opts.flattenContext.newRefs { + // Sort keys to ensure deterministic processing order + sortedKeys := make([]string, 0, len(opts.flattenContext.newRefs)) + for k := range opts.flattenContext.newRefs { + sortedKeys = append(sortedKeys, k) + } + sort.Strings(sortedKeys) + + for _, k := range sortedKeys { + r := opts.flattenContext.newRefs[k] updateRefParents(opts.Spec.references.allRefs, r) } - for k := range opts.flattenContext.newRefs { + for _, k := range sortedKeys { r := opts.flattenContext.newRefs[k] debugLog("newRefs[%s]: isOAIGen: %t, resolved: %t, name: %s, path:%s, #parents: %d, parents: %v, ref: %s", k, r.isOAIGen, r.resolved, r.newName, r.path, len(r.parents), r.parents, r.schema.Ref.String()) @@ -585,6 +596,19 @@ func stripOAIGenForRef(opts *FlattenOpts, k string, r *newRef) (bool, error) { replacedWithComplex = true } } + + // update parents of the target ref (pr[0]) if it is also a newRef (OAIGen) + // This ensures that if the target is later deleted/merged, it knows about these new referers. + for _, nr := range opts.flattenContext.newRefs { + if nr.path == pr[0] && nr.isOAIGen && !nr.resolved { + for _, p := range pr[1:] { + if !slices.Contains(nr.parents, p) { + nr.parents = append(nr.parents, p) + } + } + break + } + } } // remove OAIGen definition @@ -592,7 +616,15 @@ func stripOAIGenForRef(opts *FlattenOpts, k string, r *newRef) (bool, error) { delete(opts.Swagger().Definitions, path.Base(r.path)) // propagate changes in ref index for keys which have this one as a parent - for kk, value := range opts.flattenContext.newRefs { + // Sort keys to ensure deterministic update order + propagateKeys := make([]string, 0, len(opts.flattenContext.newRefs)) + for k := range opts.flattenContext.newRefs { + propagateKeys = append(propagateKeys, k) + } + sort.Strings(propagateKeys) + + for _, kk := range propagateKeys { + value := opts.flattenContext.newRefs[kk] if kk == k || !value.isOAIGen || value.resolved { continue } From 7a57813c18a51506dc5f4249fb66a179bdd3bc9c Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Tue, 3 Mar 2026 15:21:46 +0100 Subject: [PATCH 3/4] ci: longer timeout for tests to support integration tests Signed-off-by: Frederic BIDON --- .github/workflows/auto-merge.yml | 2 +- .github/workflows/bump-release.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/contributors.yml | 2 +- .github/workflows/go-test.yml | 2 +- .github/workflows/scanner.yml | 2 +- .github/workflows/tag-release.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 4988b17..6fad5d6 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -11,5 +11,5 @@ jobs: permissions: contents: write pull-requests: write - uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 secrets: inherit diff --git a/.github/workflows/bump-release.yml b/.github/workflows/bump-release.yml index 2aa7d2c..f8d54be 100644 --- a/.github/workflows/bump-release.yml +++ b/.github/workflows/bump-release.yml @@ -32,7 +32,7 @@ jobs: permissions: contents: write pull-requests: write - uses: go-openapi/ci-workflows/.github/workflows/bump-release-monorepo.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/bump-release-monorepo.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 with: bump-type: ${{ inputs.bump-type }} tag-message-title: ${{ inputs.tag-message-title }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 426c22c..bdff669 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,5 +18,5 @@ jobs: permissions: contents: read security-events: write - uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 secrets: inherit diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 24ef302..f241347 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -14,5 +14,5 @@ jobs: permissions: pull-requests: write contents: write - uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 secrets: inherit diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 7ead0fe..44dcf59 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -13,5 +13,5 @@ on: jobs: test: - uses: go-openapi/ci-workflows/.github/workflows/go-test-monorepo.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/go-test-monorepo.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 secrets: inherit diff --git a/.github/workflows/scanner.yml b/.github/workflows/scanner.yml index 0606d37..54108ae 100644 --- a/.github/workflows/scanner.yml +++ b/.github/workflows/scanner.yml @@ -15,5 +15,5 @@ jobs: permissions: contents: read security-events: write - uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 secrets: inherit diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 16daaab..02ab94b 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -13,7 +13,7 @@ jobs: name: Create release permissions: contents: write - uses: go-openapi/ci-workflows/.github/workflows/release.yml@a49e2c79732efcc4fb044a240fd07748f27fdfae # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/release.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 with: tag: ${{ github.ref_name }} is-monorepo: true From a39d6778e16a13837904b84b8a43dd966166e72c Mon Sep 17 00:00:00 2001 From: Frederic BIDON Date: Tue, 3 Mar 2026 15:56:40 +0100 Subject: [PATCH 4/4] ci: fixup timeout Signed-off-by: Frederic BIDON --- .github/workflows/auto-merge.yml | 2 +- .github/workflows/bump-release.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/contributors.yml | 2 +- .github/workflows/go-test.yml | 2 +- .github/workflows/scanner.yml | 2 +- .github/workflows/tag-release.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 6fad5d6..48e5a57 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -11,5 +11,5 @@ jobs: permissions: contents: write pull-requests: write - uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/auto-merge.yml@435746a4b72b06b6b6989c309fd2ad8150dbae5a # v0.2.11 secrets: inherit diff --git a/.github/workflows/bump-release.yml b/.github/workflows/bump-release.yml index f8d54be..6e5bb5d 100644 --- a/.github/workflows/bump-release.yml +++ b/.github/workflows/bump-release.yml @@ -32,7 +32,7 @@ jobs: permissions: contents: write pull-requests: write - uses: go-openapi/ci-workflows/.github/workflows/bump-release-monorepo.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/bump-release-monorepo.yml@435746a4b72b06b6b6989c309fd2ad8150dbae5a # v0.2.11 with: bump-type: ${{ inputs.bump-type }} tag-message-title: ${{ inputs.tag-message-title }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index bdff669..32fb5e3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,5 +18,5 @@ jobs: permissions: contents: read security-events: write - uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/codeql.yml@435746a4b72b06b6b6989c309fd2ad8150dbae5a # v0.2.11 secrets: inherit diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index f241347..33a469f 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -14,5 +14,5 @@ jobs: permissions: pull-requests: write contents: write - uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/contributors.yml@435746a4b72b06b6b6989c309fd2ad8150dbae5a # v0.2.11 secrets: inherit diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 44dcf59..d785200 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -13,5 +13,5 @@ on: jobs: test: - uses: go-openapi/ci-workflows/.github/workflows/go-test-monorepo.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/go-test-monorepo.yml@435746a4b72b06b6b6989c309fd2ad8150dbae5a # v0.2.11 secrets: inherit diff --git a/.github/workflows/scanner.yml b/.github/workflows/scanner.yml index 54108ae..7263d94 100644 --- a/.github/workflows/scanner.yml +++ b/.github/workflows/scanner.yml @@ -15,5 +15,5 @@ jobs: permissions: contents: read security-events: write - uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/scanner.yml@435746a4b72b06b6b6989c309fd2ad8150dbae5a # v0.2.11 secrets: inherit diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml index 02ab94b..b127808 100644 --- a/.github/workflows/tag-release.yml +++ b/.github/workflows/tag-release.yml @@ -13,7 +13,7 @@ jobs: name: Create release permissions: contents: write - uses: go-openapi/ci-workflows/.github/workflows/release.yml@92cf09d451968c28a98482d6c7a0f0e9e1eda946 # v0.2.10 + uses: go-openapi/ci-workflows/.github/workflows/release.yml@435746a4b72b06b6b6989c309fd2ad8150dbae5a # v0.2.11 with: tag: ${{ github.ref_name }} is-monorepo: true