Skip to content

Conversation

@PavelStefanov
Copy link
Contributor

Motivation and Context

Fixes #3803

Description

I added support for oneOf and anyOf attributes for example value tab.

If we have this scheme

/users:
    post:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Jessica'
                  - $ref: '#/components/schemas/Ron'
                  - $ref: '#/components/schemas/dddddd'
                  - type: object
                    properties:
                      id:
                        type: integer
                        format: int64
                      name:
                        type: string

So it will look like this

image

Each subscheme will be rendered with name and in separate highlight block.
I'll be glad to your ideas and comments!

How Has This Been Tested?

I tested different cases of oneOf and anyOf, but I'm not sure I was able to cover all cases.

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

expect(modelTab.hasClass("active")).toEqual(false)

expect(wrapper.find("div > div").length).toEqual(1)
expect(wrapper.find("div > div").text()).toEqual(props.example)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No UnitTests?

Copy link
Contributor

@shockey shockey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the functionality, but this PR needs tests 😄

@shockey
Copy link
Contributor

shockey commented Mar 27, 2018

@webron, could use your take on the visual changes

@shockey shockey requested a review from webron March 27, 2018 19:10
@alvarolb
Copy link

Nice feature!

It would be great to have this also on requests. Not sure if it is so complex, but It will be great if instead of showing all possible cases, just place a select control to select one of the possible cases.

Best.

@PavelStefanov
Copy link
Contributor Author

@heldersepu @shockey thx guys, on these weekends I'll try add unit tests

@webron
Copy link
Contributor

webron commented Apr 2, 2018

@PavelStefanov Thanks for the PR and sorry for the delay in reviewing it. I have a few comments, but they are all also related to dealing with the bigger issue at hand. I'll take the discussion back to #3803 to get more interaction from the community at large.

@shockey
Copy link
Contributor

shockey commented Mar 8, 2020

closing due to inactivity!

@shockey shockey closed this Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple responses using oneOf attribute do not appear in UI

5 participants