InternalServerError: inline enum declarations
See original GitHub issue- EdgeDB Version: EdgeDB CLI 2.0.5+53f9c9b
- OS Version: macOS Ventura (13.0 Beta (22A5342f))
I’m in the process of replacing RethinkDB with EdgeDB for my Deno-based GraphQL API so you may see me around here a lot. I created a schema file and looked through the documentation to figure out how I should be doing things. I think I’m supposed to run edgedb migration create
? Anyhoo, this is what happens when I do:
Error
edgedb error: InternalServerError: 'TypeExprLiteral' object has no attribute 'subtypes'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/server/compiler_pool/worker_proc.py", line 55, in worker
res = meth(*args)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/server/compiler_pool/worker.py", line 160, in compile
units, cstate = COMPILER.compile(
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 2204, in compile
unit_group = self._compile(ctx=ctx, source=source)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 1735, in _compile
return self._try_compile(ctx=ctx, source=source)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 1799, in _try_compile
comp, capabilities = self._compile_dispatch_ql(
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 1665, in _compile_dispatch_ql
query = self._compile_ql_migration(
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/server/compiler/compiler.py", line 1046, in _compile_ql_migration
target_schema = s_ddl.apply_sdl(
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/schema/ddl.py", line 485, in apply_sdl
ddl_stmts = s_decl.sdl_to_ddl(current_schema, documents)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/edgeql/declarative.py", line 419, in sdl_to_ddl
trace_dependencies(decl_ast, ctx=tracectx)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/functools.py", line 889, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/edgeql/declarative.py", line 926, in trace_default
_register_item(node, ctx=ctx)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/edgeql/declarative.py", line 1058, in _register_item
trace_dependencies(cmd, ctx=ctx)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/functools.py", line 889, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/edgeql/declarative.py", line 838, in trace_ConcretePointer
_register_item(
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/edgeql/declarative.py", line 1065, in _register_item
deps |= _get_hard_deps(expr.texpr, ctx=ctx)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/edgeql/declarative.py", line 1198, in _get_hard_deps
deps |= _get_hard_deps(subtype, ctx=ctx)
File "~/Library/Application Support/edgedb/portable/2.2/lib/python3.10/site-packages/edb/edgeql/declarative.py", line 1195, in _get_hard_deps
if target.subtypes:
AttributeError: 'TypeExprLiteral' object has no attribute 'subtypes'
Schema (default.edsl
)
module default {
abstract type BaseRecord {
required property created -> datetime;
required property id -> uuid;
required property updated -> datetime;
}
type Extension extending BaseRecord {
property banned -> array<str>;
required property name -> str {
constraint exclusive;
};
property premium -> array<str>;
property reserved -> array<str>;
property tags -> array<str>;
property tier -> enum<"Basic", "Common", "Epic", "Legendary", "Rare">;
#
index on (.name);
}
type Registrar extending BaseRecord {
required property email -> str;
property enrolled -> bool;
required property name -> str;
property url -> str;
#
index on (.name);
}
type Contract extending BaseRecord {
property expires -> datetime;
required link extension -> Extension;
required link registrar -> Registrar;
property valid -> bool;
#
constraint exclusive on ((.extension, .registrar));
}
type Registrant extending BaseRecord {
property email -> str;
property name -> str;
required link registrar -> Registrar;
}
type Domain extending BaseRecord {
property expires -> datetime;
required link extension -> Extension;
required property name -> str {
constraint exclusive;
};
property nameservers -> array<str>;
required link registrant -> Registrant;
required link registrar -> Registrar;
property status -> enum<
"Add Period",
"Auto Renew Period",
"Client Delete Prohibited",
"Client Hold",
"Client Renew Prohibited",
"Client Transfer Prohibited",
"Client Update Prohibited",
"Inactive",
"OK",
"Pending Create",
"Pending Delete",
"Pending Renew",
"Pending Restore",
"Pending Transfer",
"Pending Update",
"Redemption Period",
"Renew Period",
"Server Delete Prohibited",
"Server Hold",
"Server Renew Prohibited",
"Server Transfer Prohibited",
"Server Update Prohibited",
"Transfer Period"
>;
#
index on (.name);
}
}
My enums were all uppercase and not quoted but EdgeDB complained so undid that. Found an example in the repo where enums were as you see in my schema.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Build Enumerations of Constants With Python's Enum
In this tutorial, you'll learn how to: Create enumerations of constants using Python's Enum class; Work with enumerations and their members in ...
Read more >The usage of anonymous enums - Stack Overflow
Enums don't take up any space and are immutable. ... C++) and not all compilers support inline initialization of static const members.
Read more >Inline/anonymous enum declaration #4338 - GitHub
It would be handy to support anonymous enums in Haxe, similar to how anonymous types are supported. Proposed syntax: function (a:Int, b:Int, ...
Read more >Enumeration declaration - cppreference.com
An enumeration is a distinct type whose value is restricted to a range of values (see below for details), which may include several ......
Read more >how do i describe the values for an enum ? - Google Groups
"value": 500,. "label": "InternalServerError",. "description": "An unexpected condition was encountered by the server preventing it from fulfilling the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This still looks like a bug –
InternalServerError
should never surface to the user land. We’ll take a look.Yeah, simple repro is trying to migrate to
The error shows up in a different place if you use DDL directly: