!SuQCzDjUGWGtJAiyIZ:matrix.org

Litestar General

1137 Members
Main discussion room for the Starlite API open source library4 Servers

Load older messages


SenderMessageTime
12 Jan 2024
@_discord_900453511211384834:t2bot.iopedro.diaz nah, yeah I fixed it already 15:30:56
@_discord_900453511211384834:t2bot.iopedro.diaz just found it funny 15:31:00
@_discord_314787529100361748:t2bot.ioalc.alc what was the actual issue? 15:31:10
@_discord_900453511211384834:t2bot.iopedro.diaz that 15:31:17
@_discord_900453511211384834:t2bot.iopedro.diaz this one 15:31:25
@_discord_900453511211384834:t2bot.iopedro.diaz at the app layer and route 15:31:32
@_discord_314787529100361748:t2bot.ioalc.alc yeah, been bitten by it 15:31:38
13 Jan 2024
@_discord_947242363439448155:t2bot.io__peter__ Maybe that error message can be improved? 00:43:43
@_discord_256882748872982528:t2bot.io.nilsso Is there an option to set a global DTO config with max depth of zero? 01:46:38
@_discord_314787529100361748:t2bot.ioalc.alc I would suggest the fullstack way of doing this https://github.com/litestar-org/litestar-fullstack/blob/bab48d887bf2503906f5db75dde12eaf2ce85654/src/app/lib/dto.py#L49 and then apply it like https://github.com/litestar-org/litestar-fullstack/blob/bab48d887bf2503906f5db75dde12eaf2ce85654/src/app/domain/analytics/dtos.py#L17
the default / "global" value would be the value you set in the config
02:03:24
@_discord_872576125384147005:t2bot.ioGitHub Helper src/app/lib/dto.py line 49
def config(

src/app/domain/analytics/dtos.py line 17
class NewUsersByWeekDTO(DataclassDTO[NewUsersByWeek]):
02:03:25
@_discord_1166346166611476502:t2bot.iopbaletkeman_04917 What have you tried?
This seems to work:

class BMW(BaseModel): name: str class FORD(BaseModel): name: str @get(path='/sample/{variable:str}') async def display_variable(self, variable: str) -> list[BMW] | list[FORD] | str: bmws = [BMW(name='BMW1'),BMW(name='BMW2'),BMW(name='BMW3')] fords = [FORD(name='FORD1'), FORD(name='FORD2'), FORD(name='FORD3')] if variable == 'BMW': return bmws elif variable == 'FORD': return fords else: return variable
02:45:34
@_discord_1166346166611476502:t2bot.iopbaletkeman_04917 * What have you tried?
This seems to work:

class BMW(BaseModel): name: str class FORD(BaseModel): name: str @get(path='/sample/{variable:str}') async def display_variable(self, variable: str) -> list[BMW] | list[FORD] | str: bmws = [BMW(name='BMW1'),BMW(name='BMW2'),BMW(name='BMW3')] fords = [FORD(name='FORD1'), FORD(name='FORD2'), FORD(name='FORD3')] if variable == 'BMW': return bmws elif variable == 'FORD': return fords else: return variable

But if you do not know the return try at all then you could do this
async def display_variable(self, variable: str) -> Any
02:46:40
@_discord_1166346166611476502:t2bot.iopbaletkeman_04917 I appreciate how easy it was to get this example working
https://docs.litestar.dev/latest/usage/security/jwt.html#oauth2-bearer-password-flow
Other frameworks require significantly more effort and code.
Thank you
02:55:47
18 Jan 2024
@darkpup2001:matrix.org@darkpup2001:matrix.org joined the room.00:12:33
@darkpup2001:matrix.org@darkpup2001:matrix.org left the room.00:22:57
19 Jan 2024
@hasansezertasan:matrix.orgHasan Sezer TaลŸan joined the room.06:22:00
24 Jan 2024
@tobin6579:matrix.orgtobin6579 joined the room.06:44:02
3 Feb 2024
@jojo404:matrix.org@jojo404:matrix.org joined the room.20:29:27
4 Feb 2024
@tommy_pac:matrix.org@tommy_pac:matrix.org joined the room.14:17:31
5 Feb 2024
@jojo404:matrix.org@jojo404:matrix.org"I'll help anyone interested on how to earn 100k in just 24hours from the crypto market. But you will have to pay me my commission! when you receive your profit! if interested click on the group link and send me a direct message https://t.me/+FGhsj-vpp7dmZDc0 by asking me HOW19:38:42
6 Feb 2024
@jojo404:matrix.org@jojo404:matrix.org left the room.19:32:59
7 Feb 2024
@tommy_pac:matrix.org@tommy_pac:matrix.orgHello everyone Iโ€™m a Grower and supplier of quality cannabis and psychedelics products like shrooms, DMT, Lsd, Mdma, ketamine, chocolate bars,Meth, cart vapes, buds, wax, shatter, Edibles,distillates, chill pills and others like (bank notes) and cloned cards which have been tested to work perfectly๐Ÿ’ฏ. We do Prescription for patients. Best prices join channel below to see products ๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡๐Ÿ‘‡ https://t.me/hightime_markert00:06:21
@ajodo50:matrix.orgajodo50 joined the room.20:43:35
11 Feb 2024
@tommy_pac:matrix.org@tommy_pac:matrix.org left the room.08:52:53
7 Mar 2024
@jcmdln:matrix.org@jcmdln:matrix.org joined the room.03:58:05
@jcmdln:matrix.org@jcmdln:matrix.org left the room.03:58:31
8 Mar 2024
@thandekaalleta_726:matrix.orgThandeka Alleta joined the room.14:04:43
5 Apr 2024
@darksaber:matrix.org@darksaber:matrix.org left the room.16:54:05
10 Apr 2024
@thompson_plug:matrix.orgthompson_plug joined the room.22:19:29

There are no newer messages yet.


Back to Room ListRoom Version: 9