We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I encountered an issue regarding referencing schema from another yaml file.
I have directory structure like this (_index.yaml is the mock api url starting point)
_index.yaml
openapi: 3.0.0 info: title: Test description: REST API specification. version: 2.0.0 servers: - url: 'http://localhost:8000/api/v2' description: 'dev' paths: /change-password: $ref: 'user.yaml#/paths/~1change-password'
user.yaml
openapi: 3.0.0 info: title: Client - User components version: partial paths: /change-password: post: requestBody: $ref: '#/components/requestBodies/RequiredPassword' responses: 200: description: success components: requestBodies: RequiredPassword: description: Data to password change required: true content: application/json: schema: type: object properties: token: $ref: '../shared/common.yaml#/components/schemas/Token' password: type: string format: password required: - token - password
common.yaml
openapi: 3.0.0 info: title: Common components version: partial paths: { } components: schemas: Token: type: string
docker-compose yaml:
public-api-mock-server: container_name: public-api-mock-server image: muonsoft/openapi-mock:v0.3.3 ports: - "8000:8080" volumes: - ./openapi:/app/openapi environment: OPENAPI_MOCK_SPECIFICATION_URL: '/app/openapi/public-api/_index.yaml'
version: v0.3.3
error output:
panic: runtime error: slice bounds out of range [23:19] goroutine 1 [running]: github.com/getkin/kin-openapi/openapi3.(*Loader).getResolvedRefPath(0xc000183880, {0xc00013fc20?, 0xc0003aeeb8?}, 0xc0003aeeb8, 0xc00013b200, 0xc0003d4900) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:762 +0xff github.com/getkin/kin-openapi/openapi3.(*Loader).resolveSchemaRef(0xc000183880, 0xc0003ad8c0?, 0xc0003aec48, 0xc00013b200) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:702 +0x25d github.com/getkin/kin-openapi/openapi3.(*Loader).resolveSchemaRef(0xc000183880, 0xc0003ad890?, 0xc0003aea68, 0xc00013b200) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:718 +0x51b github.com/getkin/kin-openapi/openapi3.(*Loader).resolveRequestBodyRef(0xc000183880, 0x400?, 0xc0003ae8e8, 0xc00013b200) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:592 +0x511 github.com/getkin/kin-openapi/openapi3.(*Loader).ResolveRefsIn(0xc000183880, 0xc00018e460, 0x2d3?) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:186 +0x2c5 github.com/getkin/kin-openapi/openapi3.(*Loader).loadFromDataWithPathInternal(0xc000183880, {0xc0003be000, 0x2d2, 0x2d3}, 0x747048?) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:160 +0x14a github.com/getkin/kin-openapi/openapi3.(*Loader).loadFromURIInternal(0xc00013f7d0?, 0x22?) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:78 +0x54 github.com/getkin/kin-openapi/openapi3.(*Loader).resolveRef(0xc000183880, 0xc0003ac180?, {0xc00013f7d0, 0x22}, 0x4?) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:433 +0x1be github.com/getkin/kin-openapi/openapi3.(*Loader).resolvePathItemRef(0xc000183880, 0xc00018e380, {0xc0003aa5c0?, 0x10?}, 0xc00015a9a0, 0xc00013a750) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:988 +0x17b github.com/getkin/kin-openapi/openapi3.(*Loader).ResolveRefsIn(0xc000183880, 0xc00018e380, 0x200?) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:221 +0x759 github.com/getkin/kin-openapi/openapi3.(*Loader).loadFromDataWithPathInternal(0xc000183880, {0xc00027f200, 0x12d, 0x200}, 0x40e465?) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:160 +0x14a github.com/getkin/kin-openapi/openapi3.(*Loader).loadFromURIInternal(0xc00002801f?, 0x0?) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:78 +0x54 github.com/getkin/kin-openapi/openapi3.(*Loader).LoadFromURI(...) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:64 github.com/getkin/kin-openapi/openapi3.(*Loader).LoadFromFile(0xc000183880, {0xc00002801f, 0x23}) /go/pkg/mod/github.com/getkin/kin-openapi@v0.100.0/openapi3/loader.go:70 +0xd5 github.com/muonsoft/openapi-mock/internal/openapi/loader.(*autoLoader).LoadFromURI(0xc000336730, {0xc00002801f, 0x23}) /project/internal/openapi/loader/autoLoader.go:16 +0x56 github.com/muonsoft/openapi-mock/internal/openapi/loader.(*processingLoader).LoadFromURI(0xc00039fc78, {0xc00002801f?, 0x203000?}) /project/internal/openapi/loader/processingLoader.go:14 +0x46 github.com/muonsoft/openapi-mock/internal/application/di.(*Factory).CreateHTTPServer(0xc00039fd18) /project/internal/application/di/Factory.go:97 +0x145 github.com/muonsoft/openapi-mock/internal/application.newServeCommand.func1(0xc00036ac80?, {0x99d869?, 0x0?, 0x0?}) /project/internal/application/Execute.go:122 +0x94 github.com/spf13/cobra.(*Command).execute(0xc00036ac80, {0xe69c40, 0x0, 0x0}) /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:872 +0x694 github.com/spf13/cobra.(*Command).ExecuteC(0xc00036a780) /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x3bd github.com/spf13/cobra.(*Command).Execute(...) /go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918 github.com/muonsoft/openapi-mock/internal/application.Execute({0xc00039ff30, 0x2, 0x60?}) /project/internal/application/Execute.go:60 +0xb3 main.main() /project/cmd/openapi-mock/main.go:16 +0xaa
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I encountered an issue regarding referencing schema from another yaml file.
I have directory structure like this (_index.yaml is the mock api url starting point)
_index.yaml
user.yaml
common.yaml
docker-compose yaml:
version: v0.3.3
error output:
The text was updated successfully, but these errors were encountered: