I have a WCF service that will supply data to a number of third party frontend applications. With regards to this question there are two services in play. The first service has a single method that based on some properties returns a number of "products" that can be used/selected in the frontend. And this "selection" then defines which method can be called on service 2 and with which valid properties.
So the question is; how do I return these validation rules from the first method? How do I structure that data? Is there a pattern for this?
The return data should be able to define something like - you can call methodX with these properties - for each of those you can define whether they are read-only, are optional/mandatory, should be within a range or even some properties that are dependent on other. Meaning that if propertyX is true then propertyZ is optional otherwise it is mandatory.
The return should then hold a list of valid products: [(methodX with these valid properties), (methodY with these valid properties), etc. ]
This should enable the consumer to build a frontend that could have input validation before calling any of the methods on service 2. We will of course validate again once they hit our endpoints. But any ideas on how to return this data?
Aucun commentaire:
Enregistrer un commentaire