question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question on oneOf support in v2.9.0

See original GitHub issue

Hi,

I’m using version 2.9.0.

As I understand, it contains polymorphic support, ie, which I am trying to use to generate “oneOf” in the swagger document to represent an inheritance hierarchy in my models. I tried using the annotation specified here: https://github.com/springfox/springfox/issues/1151 , but I am unable to get a oneOf generated for my polymorphic type. I would greatly appreciate it if you could give me a pointer as to what I’m doing wrong.

These are my models :

@Apimodel(subTypes = {Dog.class, Cat.class}, discriminator = "type")
public class Animal {
private String type;
....getter and setter...
}

@Apimodel(value = "Dog", parent = Animal.class)
public class Dog extends Animal{
}

@Apimodel(value="Zoo")
public class Zoo {
   public Animal animal;
}

My controller method looks like this

@ApiOperation(value = "Create Zoo", nickname = "addZoo", notes = "Create Zoo", tags={ "config", })
    @ApiResponses(value = {
            @ApiResponse(code = 201, response = ZooResponse.class, message = "Resource created"),
            @ApiResponse(code = 400, response = ErrorModel.class, message = "Invalid input") })
    @PostMapping(value =  "/urest/v1/administration/zoo", consumes = MediaType.APPLICATION_JSON_VALUE,
            produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Zoo> addIngestionConfiguration(@Valid @RequestBody Zoo zoo , @RequestParam Map<String, String> params);    

thanks and regards.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

12reactions
himanshuB2commented, May 28, 2019

@dilipkrish When would oneOf be supported? I am currently having to modify all of the parent’s documentations to include information of children manually, which isn’t the best use of my life 😃

Please let me know if I can make this change myself if not already in the works. Additionally, would it be advisable to work on master branch generated artifacts?

0reactions
pgvertexcommented, Dec 22, 2021

@dilipkrish When would oneOf be supported? I am currently having to modify all of the parent’s documentations to include information of children manually, which isn’t the best use of my life 😃

Please let me know if I can make this change myself if not already in the works. Additionally, would it be advisable to work on master branch generated artifacts?

Got any update/solution for this problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next-best option in lieu of 'oneOf' in swagger (v2.0)
I've recently been diving back into REST and am looking for a tool with decent support for JSON-Schema. I'm using Swagger, and I...
Read more >
Questions and Answers for the Additional Medicare Tax - IRS
There is no change to the boxes on Form W-2. An employer will enter the total employee Medicare tax (including any Additional Medicare...
Read more >
Questions and Answers | USCIS
Who Needs to Complete Form I-9? Are election judges and poll workers exempt from completing Forms I-9 in a.
Read more >
AP United States History Exam Sample Responses
Short-answer question 2 asks students to explain the differences between. John Muir's and Teddy Roosevelt's views and identify a way that one of...
Read more >
Laravel 9 upgrade: Composer conflicts - Laracasts
Problem 1 - livewire/livewire[v2.3.3, ..., v2.9.0] require illuminate/support ^7.0|^8.0 -> satisfiable by illuminate/support[v7.0.0, ..., 7.x-dev, v8.0.0, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found