I am new to using Django drf schema generation. I installed and configured the schema according to the documentation. It generates the OpenAPI schema. Now I want to customize the choice field representation and add some description in front of each field.
Current schema choice field is like below:
condition:
enum:
- used
- new
- like new
type: string
nullable: true
I want the following:
condition:
enum:
- used: "for used items"
- new: "for new items"
- like new: " brand new items"
type: string
nullable: true
In the documentation I could find little on how to customize the AutoSchema class but that was above my knowledge. I would be grateful if someone can help me on how can I override the schema methods to represent customize fields?
Related
So I have two graphql filters for a foreign key that works in Strawberry GraphQL Django v0.31.
#strawberry.django.filters.filter(models.Client, lookups=True)
class ClientFilter:
id:auto
name:auto
#strawberry.django.filters.filter(models.Matter, lookups=True)
class MatterFilter:
id: auto
client:'ClientFilter'
category:auto
In the GraphiQL page they produce a filter that looks like this:
I don't need all the filter fields for the user because some of them don't make sense like using isNull or a regex field for an id. Is there a way to limit the filter options so it is less cluttered?
A bit late to the party, but yes you can do that but you would have to define your own input like so:
#strawberry.input
class LimitedFilterLookup(Generic[T]):
i_contains: Optional[T] = UNSET
And then instead of using auto for the fields of the filter you would declare them like this:
#strawberry.django.filters.filter(models.Client)
class ClientFilter:
name: LimitedFilterLookup[str]
I'm trying to add a static value field to the ops agent without success. This is the processor I'm using:
modify_fields:
type: modify_fields
fields:
env:
static_value: somenv
Also tried:
modify_fields:
type: modify_fields
fields:
env:
default_value: somenv
I just need all the documents sent by that machine to have a "env" field with value "someenv"
The error I'm getting is "env field not found"
Thank you
The issue was this feature was not available in the version I was using (2.16), so I upgraded to 2.18 and now works.
Also, need to follow the LogEntry structure
modify_fields:
type: modify_fields
fields:
jsonPayload.env:
static_value: somenv
Also record_log_file_path property which wasn't working is working now.
is there a way to read all categories that can be assigned to appointment?
There is a list with predefined categories and I can assign my own category(categorie1).
All that categories can be selected from "Categories" dialog.
I need this whole list in my C# project.
Default categories are hard coded:
"Holiday", "Vacation", "Projects", "Clients", "Phone Calls", "Travel"
Add these as constants to your code.
Get the additional custom categories with key "UserCategories" from profile document "CalendarProfile".
Read the values with db.getProfileDocument() from mail db:
...
Document doc = db.getProfileDocument("CalendarProfile", session.getUserName());
Object userCategories = doc.getItemValue("UserCategories");
...
Here I can read that when configuring a prospect I can add a custom field to the data, which later I can use for filtering.
So for example I can write
- type: log
paths:
- /my/path/app1.csv
fields:
app_name: app1
- type: log
paths:
- /my/path/app2.csv
fields:
app_name: app2
This means that anytime I will have a new CSV file to track I have to add it to the filebeat.yml file adding the custom app_name field accordingly.
I was wondering if I could use a regex with a capture group in the prospect definition to "automatically" track any new file and assign the right app_name value. Something like this:
- type: log
paths:
- /my/path/(.*).csv
fields:
app_name: \1
What do you think? I didn't find any documentation regarding this possibility with the fields feature.
As adviced here, I can use the source Filebeat field to filter the data. This field is the path of the harvested files, so no other field is required to filter.
When I don't provide any of the translatable properties through my submit form, then I get no validation checking, even when I have implemented:
/**
* #Assert\Valid
*/
protected $translations;
In config.yml I have:
default_locale: cs
required_locales: [cs]
All topics about this problem were giving importance on the #Assert/Valid on $translations property, which I have implemented (I have even tried validation.yml configuration).
Now I realise, that I forgot to add, that I am displaying and submiting the form through Easy Admin bundle. I am not building the form myself. Just configuring Easy Admin settings for my entity. Maybe there's some glitch.
Please refer the following answer link related to same question:
Collection array name fields validation:
A2Lix form validation for translations field
try adding required option to your easy admin type settings
- { property: 'translations', type: 'a2lix_translations', type_options: { required: true} }