Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

v2Tov3: handle parameter schema refs #455

Merged
merged 5 commits into from
Dec 2, 2021

Commits on Sep 16, 2021

  1. fix: conversion with a parameter schema ref

    converting from v3 to v2 with an endpoint using a parameter with a schema ref used to fail with the following error:
    
    ```
    --- FAIL: TestConvOpenAPIV3ToV2 (0.00s)
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    	panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x2 addr=0x58 pc=0x100f71688]
    
    goroutine 4 [running]:
    testing.tRunner.func1.2({0x101035da0, 0x1012b6160})
    	/opt/homebrew/Cellar/go/1.17/libexec/src/testing/testing.go:1209 +0x258
    testing.tRunner.func1(0x14000117380)
    	/opt/homebrew/Cellar/go/1.17/libexec/src/testing/testing.go:1212 +0x284
    panic({0x101035da0, 0x1012b6160})
    	/opt/homebrew/Cellar/go/1.17/libexec/src/runtime/panic.go:1038 +0x21c
    github.com/getkin/kin-openapi/openapi2conv.FromV3Parameter(0x140001ce7c8, 0x1400007da18)
    	/Users/vbehar/projects/oss/kin-openapi/openapi2conv/openapi2_conv.go:979 +0x138
    github.com/getkin/kin-openapi/openapi2conv.FromV3Operation(0x1400007da00, 0x14000129c20)
    	/Users/vbehar/projects/oss/kin-openapi/openapi2conv/openapi2_conv.go:895 +0x250
    github.com/getkin/kin-openapi/openapi2conv.FromV3(0x1400007da00)
    	/Users/vbehar/projects/oss/kin-openapi/openapi2conv/openapi2_conv.go:586 +0xddc
    github.com/getkin/kin-openapi/openapi2conv.TestConvOpenAPIV3ToV2(0x14000117380)
    	/Users/vbehar/projects/oss/kin-openapi/openapi2conv/openapi2_conv_test.go:26 +0x19c
    testing.tRunner(0x14000117380, 0x1010870e8)
    	/opt/homebrew/Cellar/go/1.17/libexec/src/testing/testing.go:1259 +0x104
    created by testing.(*T).Run
    	/opt/homebrew/Cellar/go/1.17/libexec/src/testing/testing.go:1306 +0x328
    FAIL	github.com/getkin/kin-openapi/openapi2conv	0.840s
    FAIL
    ```
    
    This change fixes the issue by ensuring that we correctly handle a schema ref.
    vbehar committed Sep 16, 2021
    Configuration menu
    Copy the full SHA
    256193b View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2021

  1. Configuration menu
    Copy the full SHA
    109397f View commit details
    Browse the repository at this point in the history
  2. make tests valid

    Signed-off-by: Pierre Fenoll <[email protected]>
    fenollp committed Dec 2, 2021
    Configuration menu
    Copy the full SHA
    2116bb2 View commit details
    Browse the repository at this point in the history
  3. a smaller diff

    Signed-off-by: Pierre Fenoll <[email protected]>
    fenollp committed Dec 2, 2021
    Configuration menu
    Copy the full SHA
    53c0b12 View commit details
    Browse the repository at this point in the history
  4. pass tests

    Signed-off-by: Pierre Fenoll <[email protected]>
    fenollp committed Dec 2, 2021
    Configuration menu
    Copy the full SHA
    25ce82d View commit details
    Browse the repository at this point in the history