Where to find API reference of NestJS - nestjs

I want to find the API reference of NestJS, but I can not find a good resource, the content of https://docs.nestjs.com/ is all about guidance, but the detailed API reference was not included. Please help me

Related

What is the difference between StripeAPI.defaultPublishableKey and STPAPIClient.shared.publishableKey?

I know this might seem like a simple question but I haven't found any answers in the documentation. Can someone please explain the difference between StripeAPI.defaultPublishableKey and STPAPIClient.shared.publishableKey. When are they used and for what specifically?
I'm new to coding so any help is appreciated! :)
StripeAPI is the top-level class that imports the rest of the Stripe iOS SDK. The documentation explains the defaultPublishableKey property on StripeAPI:
Set this to your Stripe publishable API key, obtained from https://dashboard.stripe.com/apikeys. Set this as early as possible in your application’s lifecycle, preferably in your AppDelegate or SceneDelegate. New instances of STPAPIClient will be initialized with this value. #warning Make sure not to ship your test API keys to the App Store! This will log a warning if you use your test key in a release build.
STPAPIClient, on the other hand, is the class/singleton you use to make Stripe API requests. The shared property on this class is the singleton, and the publishableKey property on that singleton defaults to the value of StripeAPI.defaultPublishableKey. You can, however, change it if you need to make a request with a different key, although doing so would be an uncommon edge case.
You can read more about STPAPIClient, including the properties mentioned above in Stripe's documentation.

Which function in "nestjs/swagger" converts DTOs to Swagger model definitions?

I have DTOs specified with Class-Validator and I am looking for a library that can be used to generate Swagger specification from it. I am not using it for a REST API, the code is addressing an IoT/MQTT scenario - I simply use Class-Validator to manage JSON.
NestJS/Swagger is the best maintained library. I would like to use it's capability to produce Swagger definitions without a NestJS Server. Ideally I would like to pass in a DTO definition and get it's Swagger schema.
I have been reading the source, but am struggling to understand which function in the framework actually does that. At best, I have been able to track it down to modelsDefinitions property in swagger-explorer class.
As best I can tell, from there, api-parameters.explorer and api-produces.explorer. The way they work is not clear to me. I was wondering of someone might help me out?
I'd like to add that I am aware of class-validator-jsonschema, but it is not maintained and no longer seems to work properly.
nestjs/swagger does not expose what you need as its public API which you cannot access it. The class you're looking for is SchemaObjectFactory and the method is exploreModelSchema.
Reference:
SwaggerObjectFactory
Test

Azure API Management - Import API using Swagger 2.0 spec - schema property on the responses is not considered

i would like to ask your help in relation with one issue i am facing. So basically i defined a swagger 2.0 spec for an API, and on the operation's responses i used the schema property in order to reference some definitions for objects that reflect the responses structure. I validated the spec on the Swagger Editor, and it is valid, and also if i generate the client code, using Swagger Codegen, the client app works well consuming the API. Now, the problem is. I went to the Developer Portal and on the API's details page, i checked the API definition (Open API option) and i compared the spec with my original spec that i used to import the API on the API Management service. And i noticed that the schema property is missing, so it is not referencing the schema of the response. Any idea?
Thanks
I figured out the issue. Apparently using the schema property on the responses, according to Swagger 2.0 spec, you can use nested $refs, in order to reference definitions inside each other. But apparently, it is not possible for Azure API Management Service, since it is mentioned as a limitation in the following link: API Management - API Import restrictions.
Anyway, i will try to change my API's spec in order to avoid nested $refs and workaround the issue.
Thanks

Python: adding comments to specific cell using Drive API

I am trying to automate some simple updating of a Google spreadsheet and I'm using the gspread library to do so. One task that is critical and not currently supported by gspread is the ability to add comments to a specific cell (there's an open issue for this and even a gist solution but I was getting a 404 error when trying to use it).
I know that the Google Drive API (v3) supports adding comments as described here, but I'm having issues with authenticating and could use some help.
What I have/know:
I have already setup the OAuth 2.0 and registered for the API through Google, as well as have the client_secret.json in my directory, but my knowledge of web requests and responses is limited so going through the Drive API documentation hardly makes sense. I know in order to create the comments I will have to make use of anchors and specify the cell location using column/row numbers.
What I'm stuck on:
When using the Google API Explorer, I'm getting a 400 error with the message: The 'fields' parameter is required for this method. How can I make the POST request using my authentication? I think from there I'd be able to actually add the comments myself.
I'm getting a 400 error with the message: The 'fields' parameter is required for this method
The error is asking for a property which you want returned (these properties are listed in Drive API files resource).
You can just place ' * ' to indicate you want it to return a complete response. That's the quick fix.

Node.js or Express.js REST API document generator

I'm working on a restAPI using Express.js and I'm wondering if there is a way for me to generate API documents that allow a user to view API definitions or possibly even try out the API call?
What you are looking for is a good JavaScript documentation generator. I found a decent one here http://apidocjs.com/example/.
This will allow you to use just Express as OP asked.
Swagger isn't for generating docs, it's for making APIs. So you are going to need to learn a full system to get that feature.
I found a couple more here that I haven't fully looked into yet which seem promising:
Docco here JSDoc here and an article on Documentor for Node
Swagger is an amazing project for auto generating API documentation. It includes an Express module.
http://swagger.io/
https://github.com/wordnik/swagger-node-express
I found this library to be very useful when it comes to keeping your documentation and route declaration logic close together:
https://www.npmjs.com/package/swagger-jsdoc
If you use Postman while developing you might already have a Postman collection containing the most relevant calls.
If that is the case Postman has a docs feature https://learning.postman.com/docs/publishing-your-api/documenting-your-api/

Resources