Category "enums"

OpenApi enum with multiple values

I am new to OpenApi and want to define my api with an api.yaml (OpenApi version 3.0.1). My problem is the generated enum just contains the name and not the valu

How to check if enum type?

How can I tell if a variable is of type enum? I have installed PHP 8.1 on my Ubuntu 20.04. I'm testing the new "enum" types. Is something like that possible? is

Non-nullable enum as generic parameter [duplicate]

I am trying to implement this helper function in C# 7.3: public static T? ToEnum<T>(this string enumName) where T : Enum =>

Type hint for an exhaustive dictionary with Enum/Literal keys

I'm working on code bases with extensive type hints, checked by mypy. There's several instances where we have a mapping from an enum.Enum or other small finite

Laravel 8: How to set default value of all enum values

I want to assign all default values for allowed_file_types column in products table which are all values of enum FileTypes. But now I have no way to do that. Ca

Why can't the instance member be accessed from the lambda of the enum constructor?

In the code below, I am trying to output the value of a symbol that is an instance variable of Operation from a PLUS constant. But I can't access that variable.

Conflicting enum values java

I have 2 enums defined as below in 2 separate files: MyErrorCodes.java @Getter public enum MyErrorCodes implements ErrorCode { ERROR1(90, 1, 01), ERROR2

C#; How to Loop Through/Wrap Enumerations when Incremented?

Say you have a byte value equal to its max value, so byte aByte = 255;. When you increment a value past its max value, it usually wraps around to its minimum va

How to set enum in datatable ColumnProperty of nopcommerce 4.4

I want to set enum in datatable ColumnProperty of nopcommerce 4.4. I tried things like new ColumnProperty(nameof(await(((TransmitEnumStatus)Model.StatusId).ToSe

In a Java interface, is there a way to return an enum nested in a generic type?

I'm looking for a way to return an Enum type nested in a Generic class. Here's what I mean: public interface MapperClass<E, D> { D entityToDto(E enti

Troubleshooting enums with efcore.pg

Are there any best practices in troubleshooting enums when using with Npgsql.EntityFrameworkCore.PostgreSQL provider? It's just that I don't know where to look

In json schema, how to define an enum with description of each elements in the enum?

In json schema, I can simply define a code list using "enum" with a list of code that is available, for example: { "type": "object", "properties": { "gr

Automapper with EnumMapping throws on nullable Enums with unknown value

I have a nullable enum property on the source side and get this property with value 0 instead of NULL. But 0 is not a represented value in the enum so AutoMappe

Freezed class with enum property throws error upon trying to serialize

I have a freezed class that takes an enum in its constructor, but when trying to perform the jsonEncode method on this class, it fails with the following error:

how to deserialize xml arrayItems in enum if there are unrecognized elements

The goal is to deserialize xml-arrayitems into my specific enum. using System.Xml.Serialization; public enum Example { [XmlEnum(Name = "Ex1")] Ex1,

Convert a list of enums and store as 'varchar[]'

Trying to figure out how to store a list of enums in a single table column. I started with a String and it worked. I'll show only the relevant parts of the code

Is it possible to cast from one enum to another in PostgreSQL

I need to populate a new table in a second schema from an existing one, but having problems casting the "schema1.a.disclosure_level" column enum to the "schema2

FastAPI - dynamic inputs for different data types

I have to create a very generic endpoint for a user. The user may send JSON data or may upload a file to this endpoint. There are multiple options on how to han

Call async function in Enum

I want to refactor my code from sync to async. I use Python and FastAPI. I use the method which calls async function in Enumaration. For example: from enum impo

Entity Framework. How to map class with nested Enumeration class

I am using an Enumeration class like this public class SizeUnit : Enumeration { public static SizeUnit Inch = new SizeUnit(1, nameof(Inch)); public static