Swashbuckle.AspNetCore upgrade get similar operation id - swashbuckle

current application using Swashbuckle.AspNetCore version 1.1.0
this year target to perform framework to .net core 3.1 or .net 5
at same time upgrade Swashbuckle.AspNetCore to 6.1.5
find out does not have operationid any more and need custom it
with reference https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/README.md#assign-explicit-operationids
my concern is how to get back the same operationid (same as version 1.1.0)
below is sammple of my swagger json outcome from version 1.1.0
api route with parameter (difficult)
{
"/api/Games/{id}": {
"post": {
"tags": ["Games"],
"operationId": "ApiGamesByIdPost"
}
}
}
normal sample
{
"/api/Games/Sequence": {
"get": {
"operationId": "ApiGamesSequenceGet"
}
i would resolved below one using
options.CustomOperationIds(apiDesc =>
{
return apiDesc.RelativePath.Replace("/", "") + apiDesc.HttpMethod;
});
but it only aby resolved for normal sample but not api route with parameter

You can put any string into the Name property in the HTTP method attribute
[HttpPost("someobject/add", Name = "ApiGamesSequenceGet")]
Swashbuckle will take that value as operationId for your action method.

Related

Getting the latest parameter value from the AWS Systems Manager Parameter Store and the parameter value of the version preceding it

I have a Lambda function that would like to read the value of the LATEST version of the parameter and the value of the version preceding it from the AWS Systems Manager Parameter Store.
Example: If parameter version 99 is the LATEST version, the Lambda wants to retrieve the value of the 99th version and 98th version of the same parameter.
This document suggests that AWS Systems Manager Parameter Store stores the 100 latest versions that can access the LATEST version of the parameter or a specified version of the parameter. Is there a way for the Lambda to know the version number of the LATEST parameter so the parameter version preceding it can be accessed?
Thanks!
You can get the latest version number simply using describe_parameters.
This would return Parameters with the version.
import boto3
client = boto3.client('ssm')
response = client.describe_parameters(
Filters=[
{
'Key': 'Name',
'Values': [
'<name_of_ssm_param>',
]
},
],
)
print(response)
Just put version number like <name_of_ssm_param>:version.
To get parameters, get_parameters works.
response = client.get_parameters(
Names=[
'<name_of_ssm_param>:version',
],
)
print(response)

I want to manipulate the file in MarkLogic using Python

declareUpdate();
//get Docs
myDoc = cts.doc("/heal/scripts/Test.json").toObject();
//add Data
myDoc.prescribedPlayer =
[
{
"default": "http://www.youtube.com/watch?vu003dhYB0mn5zh2c"
}
]
//persist
xdmp.documentInsert("/heal/scripts/Test.json",myDoc,null,"scripts")
You're looking to add a new JSON property. You can do that using a REST Client API request, sending a PATCH command. Use an insert instruction in the patch.
See the note in Specifying Position in JSON, which indicates that
You cannot use last-child to insert a property as an immediate child of the root node of a document. Use before or after instead. For details, see Limitations of JSON Path Expressions.
Instead, your patch will look something like:
{
"insert": {
"context": "/topProperty",
"position": "after",
"content":
[
{
"default": "http://www.youtube.com/watch?vu003dhYB0mn5zh2c"
}
],
}
}
where topProperty is a JSON property that is part of the root node of the JavaScript object you want to update.
If that approach is problematic (for instance, if there is no topProperty that's reliably available), you could also do a sequence of operations:
retrieve the document
edit the content in Python
update the document in the database
With this approach, there is the possibility that some other process may update the document while you're working on it. You can either rely on optimistic locking or a multi-statement transaction to work around that, depending on the potential consequences of someone else doing a write.
Hey #Ankur Please check below python method,
def PartialUpdateData(self,filename, content, context):
self.querystring = {"uri": "/" + self.collection + "/" + filename}
url = self.baseUri
self.header = {'Content-Type': "application/json"}
mydata = {
"patch":[{ "insert": {
"context": context,
"position": "before",
"content": content
}}]}
resp = requests.patch(url + "/documents", data=json.dumps(mydata),
headers=self.header, auth=self.auth, params=self.querystring)
return resp.content
I hope this can solve your problem.

In AWS API Gateway, How do I include a stage parameter as part of the event variable in Lambda (Node)?

I have a stage variable set up called "environment".
I would like to pass it through in a POST request as part of the JSON.
Example:
Stage Variables
environment : "development"
JSON
{
"name": "Toli",
"company": "SomeCompany"
}
event variable should look like;
{
"name": "Toli",
"company": "SomeCompany",
"environment": "development"
}
So far the best I could come up with was the following mapping template (under Integration Request):
{
"body" : $input.json('$'),
"environment" : "$stageVariables.environment"
}
Then in node I do
exports.handler = function(event, context) {
var environment = event.environment;
// hack to merge stage and JSON
event = _.extend(event.body, {
environment : environment
});
....
If your API Gateway method use Lambda Proxy integration, all your stage variables will be available via the event.stageVariables object.
For the project I'm currently working on, I created a simple function that goes over all the properties in event.stageVariables and appends them to process.env (e.g.: Object.assign(process.env, event.stageVariables);)
Your suggestion of using a mapping template to pass-through the variable would be the recommended solution for this type of workflow.
You can also access the stage name in the $context object.
Integration Request:
{
"environment" : "$context.stage"
}

How to Retrieve Current balance of the bank Account in Netsuite

I need to retrieve the current balance of bank Account in Netsuite using SuiteTalk(Netsuite Webservise).In suite talk API there is no field/parameter to refer the balance of account.But There is UI field Balance which shows the current balance of the account.Any help/suggestions on this is appreciated
If there is no field/parameter in the API referencing that UI field, it is most likely that the field is not supported by the API.
It's definitely not intuitive, but it is possible to pull this data using the API. Here's an example using the netsuite ruby bindings.
def balance_for_account(ns_account)
search = NetSuite::Records::Account.search(
criteria: {
basic: [
{
field: 'internalIdNumber',
operator: 'equalTo',
value: ns_account.internal_id
}
]
},
columns: {
'listAcct:basic' => {
'platformCommon:internalId/' => {},
'platformCommon:balance' => {}
}
}
)
search.results.first.attributes[:balance].to_f
end

is Foursquare herenow items down?

I am used to get check-ins with
https://api.foursquare.com/v2/venues/4b64c88af964a520d4cf2ae3/herenow?oauth_token=XXXXXXX&v=20120725
but yesterday, I realize that my app is not working properly. I can not get the items[](people who cheked in specific venue). Web service retrieving json like this;
{
meta: {
code: 200
}
notifications: [
{
type: "notificationTray"
item: {
unreadCount: 0
}
}
]
response: {
hereNow: {
count: 16
items: [ ]
}
}
}
seriakillaz is right -- the behavior you're seeing is intentional, and is described by the email he links to.
In general though, the hereNow is working as before if you're checking into a place (the official foursquare apps use the same endpoints we document publicly).
If you're having trouble with it after accounting for the new policy, checkout my response to seriakillaz question:
hereNow not working as expected
They've just changed the hereNow endpoint: https://groups.google.com/forum/?fromgroups#!topic/foursquare-api/rmS0DbKKOHo
However it is not working for me even if I check-in to a place...