yaml-language-server icon indicating copy to clipboard operation
yaml-language-server copied to clipboard

RFC: Support schema from a child definition

Open cdaringe opened this issue 1 year ago • 1 comments

Is your enhancement related to a problem? Please describe.

My schema is defined in https://foo.net/openapi, which returns a swagger/openapi document, but my schema needs to be a specific model in the JSON response.

That is,foo.yaml's schema is actually defined by https://foo.net.net/openapi#components.schemas.MyJsonSchemaThing

Describe the solution you would like

Support specifying a lookup path from the JSON response.

Describe alternatives you have considered

Writing a proxy server to do this path traversal for me

Additional context

OpenAPI/Swagger is a pretty common provider of JSONSchema models. Would be great to support this common use case.

cdaringe avatar Apr 17 '24 23:04 cdaringe

I dug into the source. By the time I make it to this line: https://github.com/redhat-developer/yaml-language-server/blob/dfccc6fc095faeb5d07051b51f308478cdac70fd/src/languageservice/services/yamlSchemaService.ts#L164, the .schema property will not be present. some sort of config and remapping would need occur at or before this point.

cdaringe avatar Apr 17 '24 23:04 cdaringe