swagger-api / swagger-api/swagger-ui

Where are schemas being generated.

Open
#5,100 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: support
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A (please complete the following information)
  • OS: Windows 10
  • Browser: Chrome
  • Version: 2.something? whatever swashbuckle 4.1 uses
  • Method of installation: packaged with swashbuckle
  • Swagger-UI version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration

Swagger-UI configuration options:

SwaggerUI({
        var configObject = JSON.parse('%(ConfigObject)');
        var oauthConfigObject = JSON.parse('%(OAuthConfigObject)');
        // Apply mandatory parameters
        configObject.dom_id = "#swagger-ui";
        configObject.presets = [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset];
        configObject.layout = "StandaloneLayout";
})
How can we help?

I am trying to create a plugin that will, in a hack-ey way, probably ignoring the current open API 3.0 spec, create a poly-morphic array of objects. when the json is sent to swagger-ui, it is parsed down in to the "spec" object. what I want to know where exactly are the "schema" objects for each "definitions" being generated from the spec object. for example this is a snippet from my json.

income collection one

and the actual reference.

array 2

so what I'm expecting is that when the schema object is created, which from what I understand is the object that will be displayed in the ui, will contain the description from the property level and the rest of the information in the actual reference. what I end up with while debugging is something like this...

array polly debug

this is a snippet from the model component in the render method for schema.

modelcompdebug

so for whatever schema is being passed into the model, I want to know where I can override the schema generating behavior for my plugin. I am having a doozy of a time finding this for some reason. thank you in advance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the model component's render method and tracing the schema passed to it from the parsed spec object, including definitions and references. Investigate whether Swagger UI exposes a plugin extension point for schema generation or overriding this behavior. The issue is done when the relevant entry point and supported customization path are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, openapi
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.