ServiceStack and Stripe - servicestack

I'm using the ServiceStack Stripe package, but it seems the serializer for the GetStripeCustomer method doesn't parse the Subscription Status correctly.
In the JSON I can see that the Status is "past_due", but when ServiceStack converts it to StripeCollection the Status value is "Unknown".
I'm using ServiceStack.Stripe v4.0.24
Has anyone encountered this?

There was an issue automatically converting Stripe's Lower_Case_Enums into ServiceStack's .NET enums PascalCase naming convention which should be resolved with this commit.
This change is available from v4.0.37+ that's now available on MyGet.

Related

OpenAPI Generator issue with Destination service API specification

I want to get all destinations on subaccount and instance level. In SAP API business Hub, I found the API information and "SAP Cloud SDK" tab to generate code by OpenAPI generator.
https://api.sap.com/api/SAP_CP_CF_Connectivity_Destination/overview
I downloaded the API specification and added dependencies into Cloud SDK for Java project. The code is generated successfully with some errors (unknown models)in generated api classes.
For example in DestinationsOnSubaccountLevelApi.class, model OneOfDestinationNameOnly is imported and used in method but it is not generated in model package.
I looked into API specification and found that there were two types of response entity. That is the reason why the code could not be generated properly. I can modify the API specification to make it work but it should not be the long term solution. Is there any other way to fix this issue?
Unfortunately the SAP Cloud SDK Generator for Open API services is not yet able to understand oneOf relationship that is modeled in the specification.
As an alternative, would you consider using the DestinationAccessor API for resolving single destinations?
You can also directly instantiate an ScpCfDestinationLoader, which allows for querying all destinations:
ScpCfDestinationLoader loader = new ScpCfDestinationLoader();
DestinationOptions options = DestinationOptions
.builder()
.augmentBuilder(ScpCfDestinationOptionsAugmenter.augmenter().retrievalStrategy(ScpCfDestinationRetrievalStrategy.ALWAYS_SUBSCRIBER))
.build();
Try<Iterable<ScpCfDestination>> destinations = loader.tryGetAllDestinations(options);
Similar to the default behavior of DestinationAccessor API, in the code above only the subscriber account will be considered. Other options are:
ScpCfDestinationRetrievalStrategy.ALWAYS_SUBSCRIBER
ScpCfDestinationRetrievalStrategy.ALWAYS_PROVIDER
ScpCfDestinationRetrievalStrategy.SUBSCRIBER_THEN_PROVIDER

Generate openApi DTO's with NestJS without a Controller

I am writing a NestJS service that provides a REST API and it publishes some messages to NATS. We are using the NestJS support to generate OpenAPI docs, and from the OpenAPI docs we generate an SDK that we import into our clients. This all works great, but only the REST API of our code is in the SDK.
What we'd like to also do is to have NestJS include the DTO's for the content for the messages we publish to NATS. Then our SDK will also include interfaces for these DTO's, and then our clients can cast the message content to the correct interface (based on the message subject). This way, the publisher of an event defines the content of the event, and users of it don't have to replicate the interface, yet they get strongly-typed code.
I've tried adding the #Api decorators to the DTO, but it appears that unless the DTO is used in the definition of an #Controller, it is not included in the resultant openApi docs.
I was hoping for a way to decorate a "random" DTO in my code so it will then be included in the swagger docs, and in-turn included in a generated SDK. Is something like that possible?
you can also pass extraModels array as a part of SwaggerDocumentOptions
SwaggerModule.createDocument(app, config, {
extraModels: [.......]
});
https://github.com/nestjs/swagger/issues/241

How to provide OData service via the SAP Cloud SDK for an entity with a DateTime in its key?

We are currently struggling with providing an OData service for an entity, which has as part of its key a property of type DateTime. This key property is not part of the key map in the OData request given by the SAP Cloud Provisioning SDK. This seems to be due to a bug in the parsing of the request in the method com.sap.cloud.sdk.service.prov.v2.data.provider.CXSDataProvider.getKeys(List):
if (type.toString().equals("Edm.Date")) {
Date value = type.valueOfString(keyPredicate.getLiteral(), EdmLiteralKind.DEFAULT, property.getFacets(), Date.class);
keys.put(property.getName(), value);
}
Since there is no Edm.Date type in the OData standard, my guess is that instead the following would have been correct:
if (type.toString().startsWith("Edm.Date")) {
[s. above]
}
Is this correct or are we doing something wrong here? In addition there is a TODO marker on the method itself pointing out that only a subset of EDM types is currently supported as a key. Are there any plans to fix this TODO?
As muchumanoj commented, the issue should be resolved in version 1.29.5 of <groupId>com.sap.cloud.servicesdk.prov</groupId><artifactId>odatav2-prov</artifactId>. Thanks for reporting it.

LoginApi ERROR Restsharp.addfile

Currently using RestSharp V106.1.0 as well a v2.1.8
While attempting to integrate docusign with our application I received an error off of the loginAPI:
string accountId = loginApi(username, password, integratorKey);
Receiving this error
{"Method not found: 'RestSharp.IRestRequest RestSharp.RestRequest.AddFile(System.String, System.Action`1, System.String, System.String)'."}
I have verified all of the parameters have the correct value and I was able to recreate a working API usage in a brand new project without prior packages installed. This leads me to think it is the version of RestSharp that is giving me this issue.Based on research about others having this issue it was an issue of the library change within updates.
Is there a specific version that is required as the dependancies for Docusign Package in visual studio doesn't mention a Restsharp version requirement?
Thank you in advance.

ServiceStack OpenAPI TagAttribute

Does anyone know where ServiceStack is referencing TagAttribute from. According to ServiceStack's OpenAPI documentation a route can be marked as [Tag("Core Requests")] to categorize the routes but I cannot locate where TagAttribute is actually defined. I am using ServiceStack v4.5.8.
http://docs.servicestack.net/openapi
The [Tag] attribute was added in the latest v4.5.10 release so you'll need to upgrade to v4.5.10+ to use it.

Resources