49
Views
7
Comments
 ENUM in Swagger. Drop for options

Hello.

I need to add a list of values to a GET request in Swagger.

I need a list of "booleans" with the values 'Null,True,False'. These values will serve to filter a query. In case of 'Null' I don't want to consider both values. This drop appears if the input in question is defined with the Boolean type.



The drop is correct, the problem is that if the user chooses Null '--', the value will default to false or the default value defined in the input variable (because it is boolean type ).

I've been looking at the swagger documentation and this was resolved with an ENUM-type variable. As we don't have this type in OutSystems how can I do this?

I already tried this solution but even if I put it in a static entity and do what is mentioned in the post, I can't get results. When I set the variable type equal to the static entity identifier, the swagger displays a text-type field, not a drop with static entity values.

I saw this article but I don't understand how to change the service schema or how to specify parameters by reference as the same article mentions. 

The development requirement implies that it must be a drop with these 3 values. The field cannot be of type text 


Best regards

Pedro


2025-10-18 11-13-53
Ramesh subramanian


Hi Pedro Antunes,

Please use Integer or Text. 

please check this Documentation



Thanks,

Ramesh

2017-08-13 19-08-40
Pedro Antunes

Thanks Ramesh. I tried using a static with fields of type TEXT. They weren't the boolean type.


"There is no way to create a drop in swagger. It can be of type text. For the user it will look like a drop with boolean options. although they are text"

2017-08-13 19-08-40
Pedro Antunes


I tried to create the way it was said but without success. The field is presented as text, without presenting a drop with the options.


Example of the entities:


The input of the GET method:


And the swagger input (Text. Not a drop)



Thanks for the help but it's not working 

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Pedro,

Am I correctly understanding you want to consume a REST API that has a Swagger that has an enum type? In that case, can you manually consume it, and use a Text attribute instead of the enum? If not, can you share both the result message from the external API and your structure definition?

2017-08-13 19-08-40
Pedro Antunes


Hi Killian. I didn't quite understand what you meant. "can you manually consume it, and use a Text attribute instead of the enum?" what do you mean by this? The idea is not to use text but a drop with "boolean" values. I don't know if I understand correctly :) 

Thanks for the help

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Ok, back to the basics then. A swagger file is something generated by a system that exposes a REST API. You can consume an external swagger with Service Studio so that you can call the REST API methods. If that swagger contains an enumeration, I assume that Service Studio doesn't want to consume the swagger, and you need to manuall add a method. If you then replace the enum attribute by a Text attribute in the structure, it should work.

When you expose a REST API with OutSystems, a swagger is created by the platform. However, there's no way to have that contain an enum, as enums are not supported per the documentation that Ramesh linked.

That's why I asked whether you consume or expose the API. When you said, in your original post, "I've been looking at the swagger documentation and this was resolved with an ENUM-type variable. As we don't have this type in OutSystems how can I do this?" I was assuming you were consuming a REST API. But since you now say "The idea is not to use text but a drop with "boolean" values", I'm assuming you want to expose a swagger with an enum. And like I wrote above, you just cannot do that with OutSystems, unfortunately.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.