Git Product home page Git Product logo

Comments (10)

JamesRandall avatar JamesRandall commented on July 19, 2024 1

Thanks. I don't plan on it being a permanent limitation - its more just time and getting round to it!

from functionmonkey.

fpyir avatar fpyir commented on July 19, 2024 1

@MrBliz wouldn't that be done via query parameters?

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024 1

It should “just work” for GET and DELETE verbs, there should be some docs in the section on routing:
https://functionmonkey.azurefromthetrenches.com/guides/http/routing.html

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024 1

I think it’s “just” an OpenApi doc issue - the way the parameter mapping works any parameters you don’t specify will just get the default values from your classes constructor.

I’ll fix the issue with the doc gen, let me know if you find they are actually required in practice as that would be a nasty bug!

I can’t remember if it was yourself looking for header binding but that’s nearly complete now.

from functionmonkey.

MrBliz avatar MrBliz commented on July 19, 2024

Cool, what’s your workaround? I’ve just being making optional params nullable, but then they don’t show up in swagger...

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

Generally I've defined two routes:

.../myroute
.../myroute/{param}

And thats worked for me as they've made use of different commands. Other than that I think you'd need to use a query parameter.

I am planning to do some work on Function Monkey in the next few days. Can you give me a couple of example routes you'd like to use and if I get a chance I'll see if I can work that in.

from functionmonkey.

MrBliz avatar MrBliz commented on July 19, 2024

The biggest use case I have for optional params is for paging, sorting and filtering where there might be multiple optional parameters eg: filter, page number, page size, sort column, sort direction.

from functionmonkey.

MrBliz avatar MrBliz commented on July 19, 2024

Maybe i'm missing something, but how do you use Query Parameters here? You need to supply an ICommand to the HttpFunctionBuilder?

from functionmonkey.

MrBliz avatar MrBliz commented on July 19, 2024

Re: Query Parameters

If i have the following class

public class EventListQuery
 {

     public int PageNumber { get; set; }
     public int PageSize { get; set; }
     public string Filter { get; set; }
     public bool Descending { get; set; }

     /// <summary>
     ///  Sortable Columns : Name, EventDate
     /// </summary>
     public string SortColumn { get; set; }
 }

In Swagger using Function Monkey the propertis are marked as required.

image

If use the same class in a non function monkey project

The properties are all optional, i have to explicitly set them as [Required]

image

from functionmonkey.

JamesRandall avatar JamesRandall commented on July 19, 2024

Optional route parameters now work and are in the imminent v1.0.0 release. They follow the approach documented here:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#customize-the-http-endpoint

from functionmonkey.

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.