E07760: only Integer, String, Date, Time, DateTime, Milliseconds, Duration, HTTPRequest and HTTPContext supported
What went wrong
A service method parameter uses an unsupported type.
Worked examples
Compilable examples demonstrating this error and the correct fix:
- ek9 -q 846 (Why can't I use Float as a service method parameter in EK9?)
Supported service parameter types
- Integer, String
- Date, Time, DateTime
- Milliseconds, Duration
- HTTPRequest (for full request access)
How to fix it
- Use supported parameter types
- For complex data, use HTTPRequest and parse body
See also
Examples
Every example is compiled by the EK9 compiler: the first fails exactly as captioned, the others fix it.
Fails with E07760: only Integer, String, Date, Time, DateTime, Milliseconds, Duration, HTTPRequest and HTTPContext supported
#!ek9 defines module error.e07760.bad defines class TextResponse with trait of HTTPResponse text as String? default private TextResponse() TextResponse() -> body as String this.text: body override contentType() as pure <- rtn as String: "text/plain" override content() <- rtn as Bytes: Bytes().withUtf8(text) override status() as pure <- rtn as Integer: 200 default operator ? defines service Addresses for :/addresses open byAmount() as GET for :/amount -> //A Float cannot be bound from a URI amount as Float :=: QUERY "amount" <- response as HTTPResponse: TextResponse($amount)
Fixed: Use a type that can be bound
#!ek9 defines module error.e07760.good defines class TextResponse with trait of HTTPResponse text as String? default private TextResponse() TextResponse() -> body as String this.text: body override contentType() as pure <- rtn as String: "text/plain" override content() <- rtn as Bytes: Bytes().withUtf8(text) override status() as pure <- rtn as Integer: 200 default operator ? defines service Addresses for :/addresses open //Integer, String, Date, Time, DateTime, Milliseconds and Duration can be bound search() as GET for :/{index-number}/search -> queryId as Integer :=: PATH "index-number" fromDate as Date :=: QUERY "from" span as Duration :=: QUERY "duration" timeOut as Millisecond :=: QUERY "time-out" <- response as HTTPResponse: TextResponse(`${queryId} ${fromDate} ${span} ${timeOut}`)
Questions and answers
These Q&A entries show E07760 and its fix: