Forum Discussion

aaava's avatar
aaava
New Contributor
5 years ago

How to display a combo box of items for a request field from a database

HI all.  New user here.  I've been working with Swagger for a couple of weeks, and I need to make a request field one that is selected from a list of available options.  I can find *partial* explanations via web search for using Enum, but it doesn't tell half the story.

 

I don't want to hard-code the list in an enum.  I want to read this from a database.  In fact, this list will be use in multiple model apis, so I want it to be a code once, used multiple function.

 

I've also looked here and in the swagger docs, but I can't even find where the swagger.json file is located where it says to describe an enum, and the pet shop demo that has a list box (which is not a combo box) doesn't show any code on how it was accomplished.  Can someone point me in the right direction on how to accomplish this in C#?

2 Replies

  • aaava's avatar
    aaava
    New Contributor

    No one has ever wanted to add a combox box to a request parameter?  This is obviously doable, but I can't find any documentation on specifics on how to implement this in c#.  Would really appreciate someone pointing me in the right direction.

     

    I've searched the web but cannot find anything in c# that answers the question. Since I use swaggergen I don't mess with the xml file at all, and would rather avoid doing that.

    • aaava's avatar
      aaava
      New Contributor

      This forum is unfortunately not viable.  I keep getting spam email, and not one person has bothered to respond even from swashbuckle.  I'm gonna haveto find another api front end.