ægteemil
Explore posts from serversStrongly typed i18n
Hey. I'm using the i18n module for nuxt, and I'm wondering if there's a way to achieve type-safety when using translation keys in template?
So instead of a magic string, being able to reference something type-safe indicating that they key exists
2 replies
WARN [unimport] failed to resolve [type], scip scanning
Hey. I'm using a library to automatically create a service to match my backend API from its open-api spec. I've added the types from this as an auto import:
This directory has four files,
index.ts
and the files it's showing an error for.
index.ts
exports the other three files - maybe this is causing the issue?
This is working, and I can use the types specified in these files, but it's spitting out an error when i run dev
or any type-checking.
WARN [unimport] failed to resolve "C:/git/Gilbert/src/Gilbert.App/app/services/gilbert-api/schemas.gen", skip scanning
WARN [unimport] failed to resolve "C:/git/Gilbert/src/Gilbert.App/app/services/gilbert-api/services.gen", skip scanning
WARN [unimport] failed to resolve "C:/git/Gilbert/src/Gilbert.App/app/services/gilbert-api/types.gen", skip scanning1 replies
✅ Describing `object` response in swagger
Hey. I have an endpoint that returns an object that looks something like this.
where
Payload
can change depending on the enum value. In typescript or other languages, I'd represent this object as a union type, but since we don't have that in C#, I'd just like to describe the possibilities of this in my swagger documentation14 replies
✅ Apply multiple attributes from custom attribute
Hey. I want to encapsulate some duplicated logic from a custom attribute. Right now I'm decorating endpoints with multiple attributes, and I'd like to be apply to just apply my own custom attribute, and have that attribute apply multiple other attributes.
So my custom attribute would look like this(?):
12 replies
Route guards for user permissions
Hey. I want to add navigation guards that check if a user has a required permissions before nagivation to a given page, or any sub-pages of it. Right now I have a somewhat crude implementation, and I'm curious if there's a better way of handling it.
5 replies
`useAsyncState` equivalent in Nuxt
Hey. Up until now I've been using
useAsyncState
from VueUse when doing any CRUD work through a service of mine, and I'm curious if this is bad practice and if there's an equivalent function baked into Nuxt?
Today I'm doing something like this, which I'm looking to translate similarly to a Nuxt composable of some sort:
3 replies
❔ streaming an IAsyncEnumerable<string> from complex type
hey. i have a minimal api that looks like this:
it's registered like this:
but whenever i visit the url, the answer is not being streamed but rather returend as one large string. i tried making a dummy endpoint that works like expected, but im unsure how to modify the above code so it works. this is the test that worked for me:
13 replies
❔ Required select field missing validation error message on iOS
Hey. If I create a
required
select
field, and the select field is outside the current viewport (ie., if you've scrolled further down on the page), the browser doesn't jump to the required select and the validation message is missing.
I managed to find a recent stackoverflow question for exactly this, but there's no comments on it. Does anyone here have an idea for how to fix it?
https://stackoverflow.com/questions/75854715/html5-form-validation-with-select-field-on-ios-15-16-bug2 replies
❔ The foreign key property 'UserRole.RoleId1' was created in shadow state
I've expanded the default
IdentityUserRole
implementation for .NET identity like this:
And I've included the User
and Role
as navigation properties, which is now causing EF to write this when creating a migration:
The foreign key property 'UserRole.RoleId1' was created in shadow state because a conflicting property with the simple name 'RoleId' exists in the entity type, but is either not mapped, is already used for another relationship, or is incompatible with the associated primary key type
I'm not sure how to configure this properly and avoid the new foreign key property2 replies
Disable bootstrap multiselect options after selecting
Hi. I have a bootstrap
<select multiple/>
. When one is selected, I want to disable all other selections temporarily (while waiting for an API response), then enable them again after the response. I can't seem to find a good example of this6 replies