Skip to content

Conversation

@knom
Copy link
Contributor

@knom knom commented Dec 1, 2017

@mandrean @jimschubert
#7097

This uses this.StatusCode(..) to render more verbose STUBS for the Controllers.
So people that are less familiar with ASP.NET Core can understand how it works..

@jimschubert
Copy link
Contributor

@knom Thanks this is a really helpful addition.

My only comment is more of a question (or suggestion). Rather than returning actual code, couldn't we just document the returns as todos themselves, for example:

// TODO: return StatusCode({{code}});

Reason I ask is because many people use static code analysis and if(false) is likely to fail compilation while working through these stubs, in which case the developer would have to manually comment out these conditions.

@knom
Copy link
Contributor Author

knom commented Dec 2, 2017

@jimschubert:
Great suggestion!

Should I update it or will you?

@jimschubert
Copy link
Contributor

@knom If you could, it would be faster. I don't have push access to the repo. I really appreciate the contributions!

@knom
Copy link
Contributor Author

knom commented Dec 2, 2017

@jimschubert all done!
Let me know what you think ;-)

{ {{#responses}}{{#dataType}}
//TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ...
// return StatusCode({{code}}, default({{&dataType}}));
{{/dataType}}{{^dataType}}
Copy link
Contributor

@wing328 wing328 Dec 5, 2017

Choose a reason for hiding this comment

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

@knom Please use the following instead to allow empty lines with spaces:

            {{#dataType}}
            ...
            {{/dataType}}
            {{^dataType}}
            ....
            {{/dataType}}

@wing328
Copy link
Contributor

wing328 commented Dec 5, 2017

@knom please run bin\windows\aspnetcore-petstore-server.bat to update the petstore samples.

@knom
Copy link
Contributor Author

knom commented Dec 5, 2017

Just updated the formatting!
Is this what you were looking for @wing328 ?

Your comment wasn't fully clear to me..

THANKS!

"Newtonsoft.Json": "9.0.1"
"Newtonsoft.Json": "10.0.3",
"JsonSubTypes": "1.1.3"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not part of my updates.. note sure why this is changing...

[EnumMember(Value = "sold")]
SoldEnum
SoldEnum = 3
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not part of my updates.. note sure why this is changing...

[EnumMember(Value = "placed")]
PlacedEnum,
PlacedEnum = 1,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not part of my updates.. note sure why this is changing...

/// Add a new pet to the store
/// </summary>
/// <remarks></remarks>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not part of my updates.. note sure why this is changing...

@wing328
Copy link
Contributor

wing328 commented Dec 5, 2017

Is this what you were looking for @wing328 ?

Yup, sorry that I wasn't clear.

@wing328 wing328 merged commit 645d71e into swagger-api:master Dec 5, 2017
@wing328 wing328 changed the title Operation now returns StatusCode Stubs as well [ASP.NET Core] Operation now returns StatusCode Stubs as well Dec 5, 2017
@knom knom deleted the response2 branch December 5, 2017 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants