How to display Groups alphabetically on swagger-ui? - swagger

I'm using Swashbuckle.AspNetCore to create my swagger-ui.
I can order operations within a group the way I want, but how to order the groups themselves?
Ex: the correct order would be: ContratedDemand, Demand, Subscriptions and Users, but I'm getting as the image below.
I'm using Swashbuckle.AspNetCore 1.2.0
UPDATE: According to #HelderSepu (tks!), I have to set the Tags and the operations will be ordered according to them.
So, how to set the tags the way I want using Swashbuckle?

I finally found the problem.
The issue was due a conflict with the "LowerCaseDocumentFilter" (an IDocumentFilter) used to create all paths with lower case instead of the default .net PascalCase.
The code I was using was found here: https://github.com/domaindrivendev/Swashbuckle/issues/834
That class works fine for its purposes, but as it adds and removes the paths from the SwaggerDocument path dictionary, it changes the groups order as a side effect.
I removed this filter and the groups are now ordered alphabetically.

Related

ServiceNow Rest API (using PowerBI)

I'm on a project in which I need to get data from a ServiceNow instance and treat all data with PowerBI. I'm able to retrieve a big amount of data (Snow collect a lot of data), but I still need a way to filter data correctly. I'm calling to this URL:
Besides, I want also to apply a filter to retrieve just some specific registries from the table Requested Items. For that, I use the sysparm_query parameter to filter the field "cmdb_ci" and more specifically it's "name", something like:
&sysparm_query=cmdb_ci=What I need to Filter
Apart from this, I have also tried:
&sysparm_query=cmdb_ci.value=What I need to Filter
&sysparm_query=cmdb_ci.display_value=What I need to Filter
&sysparm_query=cmdb_ci.sys_id=What I need to Filter
&sysparm_query=cmdb_ci.name=What I need to Filter
But still not found the solution... as all these does not respond the solution needed.
Does someone know how I can manage this?
Thanks!!
JLG
There are two "Configuration item" fields in sc_req_item: cmdb_ci and configuration_item. Make sure that you are using the correct one. Either cmdb_ci.name=value or configuration_item.name=value should work, depending on which of the two fields you are using. cmdb_ci.value and cmdb_ci.display_value will not work as there are no fields on the record with these names. cmdb_ci.sys_id should work if you are supplying a sys_id (although it is redundant to type .sys_id for a reference field).
You should first verify your query through the ServiceNow UI before attempting to use it in an API call.
Type sc_req_item.list in the Filter navigator
On the filter list select "Show related fields"
Get your filter to work correctly
Right-click on the filter and select "Copy query"
The next step is to test it using the REST API Explorer.
Final step is to configure your client tool (PowerBI).

Get all groups with groupLifecyclePolicy enabled via Microsoft Graph

I'm assigning groupLifecyclePolicy to thousands of O365 groups via my webapp and I need a way to retrieve the groups that have the groupLifecyclePolicy assigned without querying every single group individually.
Unfortunately the groupLifecyclePolicy does not have a "List groups with specified groupLifecyclePolicy" method.
Is there any way to create a filter that filters on this?
I tried
'https://graph.microsoft.com/beta/groups/5e879c76-cd26-4238-a94f-ba0ade56a659?select=id,displayName,groupLifecyclePolicies'
but only got the 2 other attributes. I think this means, that the attribute is a lookup elsewhere.
Does anyone know of a way to apply a filter similar to (pseudocode):
'https://graph.microsoft.com/v1.0/groups?$filter=contains(groupLifecyclePolicies)'
or any other way that does not involve calling:
'https://graph.microsoft.com/beta/groups/<id>/groupLifecyclePolicies'
for all groups?
Unfortunaly it is not possible. The only way, indeed is to separate it in multiple requests.
Get all group id`s:
https://graph.microsoft.com/v1.0/groups?$select=id
Get policy property:
https://graph.microsoft.com/v1.0/groups/{id}/groupLifecyclePolicies
Make sure to add Retry-After header to avoid throttling(https://learn.microsoft.com/en-us/graph/throttling)

Retrieving More columns as Part of VSTS query

I'm trying to fetch details from VSTS using VSTS query API. So to get all Portfolio Epics I created a custom query and used its ID to get that in JSON format. the query looks like this
https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql/{id}?api-version=5.0-preview.2
But the issue is its not giving me many details about each of the work items in JSON. It only lists the ID and URL. Like this
WorkItems:[
{ID:234,URL:"workitemurl"},
{ID:235,URL:"workitemurl"},
{ID:236,URL:"workitemurl"},
...
]
So if I need more details about an item I need to execute those individual URl for each PE and thus I can get its details. instead of I am just checking is there is any way of getting an ID (keyedinID of each work item along with the ID and URL) like this. Please note KID is a field if we execute the URL separately. So to avoid that extra process, I would like to get that along with the WorkItems.
WorkItems:[
{ID:234,URL:"workitemurl",KID:002},
{ID:235,URL:"workitemurl",KID:023},
{ID:236,URL:"workitemurl",KID:033},
...
]
So how can we make this possible?
The Web UI uses a different API to get query results (/_api/_wit/_query), which allows query+data in a single pass. This is an old __v5 type call, which means it's considered internal.
The proper way to do this now is to first do the query as you're doing it right now and then call /_api/wit/workitems?ids=1,2,3,4 using the IDs from the references you got from the first call. That will also allow you to load the details dynamically and in small batches which will result in a more responsive UI.
See:
https://learn.microsoft.com/en-us/rest/api/azure/devops/wit/work%20items/list?view=azure-devops-rest-4.1

Meteor publish-with-relations VS collection-helpers for joins?

What's the best way to do joins in Meteor/mongo? Use one of these packages, or something else:
publish-with-relations
https://github.com/erundook/meteor-publish-with-relations/blob/master/publish_with_relations.coffee
collection-helpers
https://github.com/dburles/meteor-collection-helpers
I'm very familiar with PWR, but collection-helpers is new to me. It looks like the two are complimentary.
PWR solves the somewhat complex problem of publishing documents to the client via a reactive join based on arbitrarily complex relationships. See this question for more details.
collection-helpers appears to be a set of convenience functions added to the client to be used when traversing collection relationships inside of a template (given that the required documents have already been published). For example, if you have books and authors in separate (but related) collections, you can immediately get myBook.author.fullName inside of a template without having to type out the extra find for the author.
currently the top popular solution in atmosphere seems to be publish-composite https://atmospherejs.com/reywood/publish-composite

Rails Dynamic tag generation from context

Let's say I want to trend all comments posted on a site and create dynamic tags. For example, If there are x number of comments that contain the word iPad I would like to create automatically create a tag called "iPad" and put it in a tag cloud.
Is this possible? I checked out the acts_as_taggable gem but it requires one to specify a tag, I guess I am looking for a way to generate tags from content.
Well something like the yahoo term extraction service might do the trick and there is a plugin for it http://expressica.com/auto_tags/.
Though it is not for commercial use.
Sure, this is possible.
Just parse the content of each comment as it's passed in and attach the tags you're interested in.
This can either work on a whitelist - where you specify all the tags you're interested in and attach those if relevant.
Or it could work on a blacklist - where you specify all the words to ignore, e.g. "the", "on". This approach is probably a lot more time consuming, but would allow for more dynamic results.
I would probably work on a white list, then have an ability to add new tags to the whitelist and have it go back and retroactively add the tags where applicable.

Resources