redhat-developer / yaml-language-server

Language Server for YAML Files
MIT License
1.01k stars 244 forks source link

RFC: Support schema from a child definition #960

Open cdaringe opened 2 months ago

cdaringe commented 2 months ago

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 commented 2 months ago

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.