Git Product home page Git Product logo

Comments (9)

ad-on-is avatar ad-on-is commented on June 2, 2024 1

Fixed in 3.11.0

// example usage
* @requestFormDataBody <User>.exclude(id).append("picture":{"type":"string","format":"binary"})

from adonis-autoswagger.

ad-on-is avatar ad-on-is commented on June 2, 2024

There is already a format decorator for the model field

export default class User extends BaseModel {
  @column()
  // @format(binary)
  declare file: string
}

from adonis-autoswagger.

zecar avatar zecar commented on June 2, 2024

My model does not have a property for that

@column()
declare imageUrl: string

the endpoint request takes a "file" property, not imageUrl that is a file

from adonis-autoswagger.

ad-on-is avatar ad-on-is commented on June 2, 2024

based on your example, I'd assume your model has other properties too. i.e. name, email, etc... so you'd need to link that file to some property, wouldn't you?

in other words, how do you expect to handle the submitted formdata otherwise?

from adonis-autoswagger.

zecar avatar zecar commented on June 2, 2024

Yes, I have multiple properties

In my particular case, I take the file from the "file" property on the request, alongside other Model properties.

I upload the file and populate Model.imageUrl with the uploaded file's path, then save

from adonis-autoswagger.

ad-on-is avatar ad-on-is commented on June 2, 2024

Well, there you have your answer. then just add a "virtual" field file to your model... doesn't have to be mapped to a column.

from adonis-autoswagger.

zecar avatar zecar commented on June 2, 2024

yes, but then I would have to exclude it from everywhere I have the Model referenced, right?

from adonis-autoswagger.

ad-on-is avatar ad-on-is commented on June 2, 2024

yes! 😅

out of curiosity, did you try the append() notation? does it work on formdata?

from adonis-autoswagger.

zecar avatar zecar commented on June 2, 2024

append() does not work and neither does exclude()

it just displays the whole model inside

from adonis-autoswagger.

Related Issues (20)

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.