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.

An in body parameter with discriminator does not show up in the method signature

See original GitHub issue

I have an API with the following parameter in the swagger spec -

{
        "name": "resultQuery",
        "in": "body",
        "description": "Query to retrieve results based on the query type.",
        "required": true,
        "schema": {
          "$ref": "#/definitions/ResultQuery"
}

This is the schema for the object -

{
	"ResultQuery": {
		"description": "Query for a particular result.",
		"required": ["queryType"],
		"type": "object",
		"properties": {
			"queryType": {
				"description": "Query type which specifies which result needs to be queried.",
				"enum": ["Enum1", "Enum2"],
				"type": "string",
				"x-ms-enum": {
					"name": "ResultQueryType",
					"modelAsString": false
				}
			}
		},
		"discriminator": "queryType"
	}
}

When I generate the client DLL for this spec, the method signature does not have the ResultQuery. However, It works when I remove the discriminator attribute from the schema of “ResultQuery” but then the method does not support polymorphism.

Any workarounds for this?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
fearthecowboycommented, Jan 25, 2017

Yes, #1726 should have fixed it. (Fixed it in the test I created 😃 )

0reactions
smkuls-msftcommented, Jan 31, 2017

@fearthecowboy Sorry for responding so late. Yes, the issue seems to be have been fixed. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling exception at a controller method signature
When I use the annotation @RequestBody(required = false) , the request body is mapped to a null object.
Read more >
Amazon API Gateway important notes
API Gateway does not support sharing a custom domain name across REST and WebSocket ... The discriminator parameter is not supported in any...
Read more >
Customize what happens in Model.fit | TensorFlow Core
Let's start from a simple example: ... The input argument data is what gets passed to fit as training data: ... In the...
Read more >
OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.
Read more >
HL7.FHIR.UV.SHORTHAND\Language Reference - FHIR v4.0.1
It is up to implementations to define the association between FSH items and FSH projects. The order of items, regardless of format, SHALL...
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