Code Monkey home page Code Monkey logo

Comments (18)

nelsongomes avatar nelsongomes commented on July 17, 2024

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

It is not a good practice to use array directly in the body, but inside an object

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

thanks for your quick respond, but the doc says

ALWAYS RETURN JSON WITH AN OBJECT ON THE OUTSIDE
Always have the outside primitive be an object for JSON strings

but we're talking about request body, is there anything inappropriate to send an array as request body?

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

image

https://www.ibm.com/docs/en/urbancode-build/6.1.2?topic=reference-rest-api-conventions

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

I'm afraid we have misunderstanding here. It seems I'm talking about when request body schema is in Array, it has an error, while you're talking about it's not a good idea to send Array back client side. Right?
Sorry about that.
Let me clearify my situation.

I'm working on a tool to work with an internal Koa framwork to generate swagger api doc.
Here -> https://github.com/Zsynuting/ts-swagger-doc
So, I use ts-openapi to generate JSON schema and then use swagger-ui-koa to consume the JSON schema and serve swagger doc.
But when I describe a POST request body an Array, there happened the exception above.
See sample at line 32.
https://github.com/Zsynuting/ts-swagger-doc/blob/main/sample/controller.ts

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

Can we have a call today?

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

Sure, how about 10:00 PM China time, how would you like to do the call?

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

meet.google.com/jjn-obkr-hpn in around 2h45

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

got it

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

https://github.com/Zsynuting/ts-openapi-issue/blob/main/src/index.ts

just find out if according to ts type constraint, I can't replicate the issue. but I still think my case is considerable. please check it out.

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

working on it, but expect a few days to solve it

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

FYI finishing my tests, should be ready in a day or two, sorry for the delay, but between work and holidays, haven't had much time available.

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

cool! No problem, just take your time.

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

check version 1.1.0 please

from ts-openapi.

Zsynuting avatar Zsynuting commented on July 17, 2024

it works perfect, thanks man!

from ts-openapi.

nelsongomes avatar nelsongomes commented on July 17, 2024

Closing issue then. Thanks.

from ts-openapi.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.