I'm trying to generate API documentation for my Web API project using XML comments via Swagger & Swashbuckle. It seems that using the ActionName attribute on an action breaks something somewhere along the line. The action is included in the generated XML and it shows up in the Swagger UI, but there are no details (summary, param, etc) when I click on it. I'm not sure if this is a .NET, Swagger, or Swashbuckle issue.
I've tried with and without the ActionName attribute and it seems to have no impact on the XML that gets generated. The attribute does, however, change the name that is displayed in Swagger. This leads me to believe that it might have something to do with Swagger/Swashbuckle... maybe ApiExplorer?
I've determined this is a bug in Swashbuckle. .NET generates the XML documentation with the actual method name, not the name specified in the ActionName attribute. Therefore, it needs to be handled in the Swashbuckle code. I've entered an issue in GitHub, including a workaround until it is fixed -- https://github.com/domaindrivendev/Swashbuckle/issues/118.
Related
I'm using OpenApi 3.0 and Swagger UI.
(Swashbuckle and ASP.Net Core if it's important)
I have multipart/form-data which has 2 parameter:
ProductToAdd object description in JSON
Image as file.
I have schemas and examples defined.
For now I managed to do this
And I'm targeting something like this:
My question is how to render schemas and examples like in the second pictures?
I didn't find anything helpful in swagger.json and so.
Ps. Execute work perfectly if you are curious.
#edit
I've made nuget package for that. You can find it here
Currently (as of May 2022) Swagger UI does not display the schemas of object-type fields in multipart/* requests, it only displays the example values for these fields. Here's the corresponding feature request:
Display static documentation information for multipart properties in OpenAPI 3.0 files
I'm trying to generate a custom response example value using NSwag. When using Swashbuckle there are attributes for it, but I'm not sure how to do it in NSwag.
I found this thread, but I'm not familiar enough with Swagger to translate the code.
Does anyone have any complete examples of how to achieve this functionality?
If you know the expected JSON field and structure of the sample, you can implement this yourself by modifying the code in this blog: https://blog.rsuter.com/nswag-tutorial-implement-a-custom-operation-processor-to-define-redoc-code-samples/
I followed the instructions here on establishing a new provider and generating custom URLs, and it works as expected. There doesn't seem to be a clear reference for what parameters can be utilized in the settings as the example given is very basic.
I want to use the category name of the post in the URL. I tried:
/[Category]/[UrlName]
but what I got in the frontend was:
http://localhost:60327/my-page/Telerik.OpenAccess.TrackedList%601[System.Guid]/my-post-name
I also tried
/[Category.Title]/[UrlName]
which just threw errors.
Anyone know how to do this, or better yet, a good reference for the parameters?
I don't think this is possible since the Category property is actually a collection (TrackedList).
In theory you would need one of the collection items, let's say the first one, and your URL expression would be /[Category[0].Title]/[UrlName], but this is currently not supported by the expression parser.
Also, the idea of making the URL dependent on a complex (related) field is not a good idea. If someone deletes that category, they will break all your blog post URLs.
I would suggest you to create a custom text field for the blog post item (ex: CategoryUrl) and then you should be able to set the URL format to /[CategoryUrl]/[UrlName]. Make sure CategoryUrl field is required.
I'm writing a REST client to look at project information available from several gitlab servers at the same time in one consolidated place. I understand REST and am able to pull the project details I need except one: the tags.
I'm not talking about git repository tags, those I'm able to get to just fine. I'm referring to the tags that are set under Project Settings. These are tags that, from what i can tell, are meant to be a form of describing the project, not referencing a particular commit hash.
I submitted a merge request back to the Gitlab folks, if accept, any REST call that involves a Project class will include a "tag_list" field with all the project labels.
The merge request is available here: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/329
EDIT: This was merged in Gitlab version 7.10.0 so now you can just run a GET on the Project and the tag_list will be included with the JSON response.
Try this:
http://www.example.com.br/api/v3/projects/#{str}/repository/tags?private_token=yourtoken"
Note that in #{str} variable, if you using a group/repository structure, you must replace the dash to %2F, for example, you must set:
http://www.example.com.br/api/v3/projects/group%2Frepository/repository/tags?private_token=yourtoken"
The response to your request will be the body. So you can console log response.body to retrieve the tags.
Not possible: ACCEPTING MERGE REQUEST at: http://feedback.gitlab.com/forums/176466-general/suggestions/6325819-project-labels-via-api , so feel free to implement it if you need it.
Should be simple: just return the project.tag_list (see: https://github.com/mbleigh/acts-as-taggable-on) as a JSON list from https://github.com/gitlabhq/gitlabhq/blob/41518a467dcef61deca24ad2f6205c6fd5706e1b/lib/api/projects.rb#L60
Always check the request tracker first for features ;) True, in this case you may have done it an not found because of label vs tag keyword confusion, I think it was renamed at some point, so always search for both.
Hi I'm am trying to get the list of issues from a JIRA server using the SOAP API provided by JIRA.
I'm trying to filter the issues based on a custom field (and latter I will want to set that custom field).
If I get the list of issue it returns the custom fields for those issues along with them (I get customfieldId, key, values for each custom field) and I can get the custom field with getCustomFields methods provided by the API (to look for the ID of the field with a given name).
The issue I have is that if I login with an account that is not an admin (using the API) I can't call the getCustomFields method (it throws an exception saying I have to be an admin to do that).
My question is: Is there any other way to know which is the ID of the custom field I desire that can be done using a normal user account?
Also if you know how to set a custom field for an issue, it would also be very helpful :) (I would also like to be able to do it with a regular user account).
You have to be an admin to get a list of custom fields. Any 'normal' account can act on the custom fields via the API provided the user knows the customfield ID.
You can set the value of a custom field too, even with a 'normal' account. Again, the user needs the appropriate permissions to do this. Example provided here.
More here and here.
You can also use getFieldsForEdit(token, issueKey), which will return RemoteField[] for all fields available for edit on that issue (even if it has not yet been defined on the issue). It does not require admin permissions, but because it has the word "Edit" in the method, it does require that you have permission to edit the issue (which means, e.g., if the issue is status=Closed, it will raise an exception unless you allow editing closed issues. Unfortunately, I have yet to find a way to retrieve the RemoteField[] list (in order to map id to name), so getCustomFields() and getFieldsForEdit() appear to be the only options.
Have you tried getting a list of issues from the project, picking one, zeroing out the data, and using that as a template? That might work.
SOAP is being deprecated in favor of the REST API, which also has a better method to get this information