Comments (11)
@micalevisk Is this intended spec of NestJS? Or just unexpected behavior but just supported by express?
@yadav-saurabh If you want to generate SDK library through nestia
, I think it would better to follow its guide. The params
type is called object literal expression type (unnamed, implicit)
, and nestia
does not allow such unnamed type. Also, considering the characteristics of @nestia/sdk
, such spec can't be allowed because the client side SDK library should keep the consistency, but such way makes client developers confused.
export class SomeClass {
public someMethod(
@Param("a") a: string,
@Param() params: {
b: string,
c: string,
} {}
}
from nestia.
@yadav-saurabh Is it okay to support object typed
@Param()
, but SDK library decomposes it to individual parameters?
yes, my initial thinking was the same. They are going be individual parameters from the frontend POV, just nestjs (maybe express) makes an object so that's easier to access if there are multiple parameters.
from nestia.
I don't see anything wrong with that code snippet
from nestia.
Ah, understood. It was the original spec of NestJS. Thansk for quick response @micalevisk
In the object type case, how @nestjs/swagger
composes the parameters (OpenApiOperation.parameters
) ?
from nestia.
@yadav-saurabh Is it okay to support object typed @Param()
, but SDK library decomposes it to individual parameters?
If @nestjs/swagger
supports the object type @Param()
case with exact strategy, I'll support it.
from nestia.
In the object type case, how
@nestjs/swagger
composes the parameters (OpenApiOperation.parameters
) ?
type defs like that has not effect for @nestjs/swagger
(the CLI plugin)
from nestia.
In the object type case, how
@nestjs/swagger
composes the parameters (OpenApiOperation.parameters
) ?type defs like that has not effect for
@nestjs/swagger
(the CLI plugin)
Then should I define @ApiParam()
to the object typed path parameter, and write the object path parameter type with @ApiProperty()
?
from nestia.
it will work if you don't use types but concrete classes (with no decorators, if you're using the @nestjs/swagger
plugin), due to how tsc works
or if you use @ApiParam()
, of course
not sure about the behavior when using both approaches
from nestia.
@micalevisk Thaks for help.
@yadav-saurabh To accomplish this mission, I've to disassemble the object typed @Param()
in the compilation level, and it needs lots of change in both @nestia/core
and @nestia/sdk
projects. Furthermore, as @Param()
is not of my development, but of pure NestJS feature, it may needs lots of time.
By the way, this mission's benefit for users is a little bit lower, so that would be delayed due to lower priority.
Until that, recommend to avoid using the object typed @Param()
.
from nestia.
@micalevisk Thaks for help.
@yadav-saurabh To accomplish this mission, I've to disassemble the object typed
@Param()
in the compilation level, and it needs lots of change in both@nestia/core
and@nestia/sdk
projects. Furthermore, as@Param()
is not of my development, but of pure NestJS feature, it may needs lots of time.By the way, this mission's benefit for users is a little bit lower, so that would be delayed due to lower priority.
Until that, recommend to avoid using the object typed
@Param()
.
Yes, I can understand.
Thanks for the quick response
from nestia.
Will start this ticket after #211
from nestia.
Related Issues (20)
- Very slow reaction on NX dev + loaders error
- How to customize error message? HOT 1
- SDK generator for `@WebSocketRoute()` functions
- How to properly use nestia in Docker HOT 1
- Enhance `@nestia/sdk` performance by abandoning `ts-node` HOT 5
- is tsconfig's strictPropertyInitialization property safe to set false? HOT 3
- Text after the comma disappears in TypedFormData.Body HOT 2
- Cannot find module 'get-funtion-location' HOT 2
- In version `3.1.4` of @nestia/core, `nestia sdk` throws a `no transform has been configured` error. HOT 2
- [Bug Report] Parsing incorrect module paths HOT 1
- [Question or Bug Report] decompose option's bug on swagger generator with special tags, defined anonymous interface. HOT 2
- Generic interfaces are not included in SDK when using @WebSocketRoute and clone: true HOT 4
- `TypedParam` should use validator configured in tsconfig just like `TypedQuery` / `TypedBody` HOT 2
- How to use on Nest monorepo structure ? HOT 2
- RangeError: Maximum call stack size exceeded HOT 12
- Nestia SDK not working with Monorepo or Thirdparty HOT 1
- e2e Generation is failed HOT 6
- Long output type names cause syntax errors HOT 1
- Using SDK in a React native project HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestia.