| 36 | |
| 37 | |
| 38 | class EnvironmentSerializerLight(serializers.ModelSerializer[Environment]): |
| 39 | use_mv_v2_evaluation = serializers.SerializerMethodField() |
| 40 | |
| 41 | class Meta: |
| 42 | model = Environment |
| 43 | fields = ( |
| 44 | "id", |
| 45 | "uuid", |
| 46 | "name", |
| 47 | "api_key", |
| 48 | "description", |
| 49 | "project", |
| 50 | "minimum_change_request_approvals", |
| 51 | "allow_client_traits", |
| 52 | "banner_text", |
| 53 | "banner_colour", |
| 54 | "hide_disabled_flags", |
| 55 | "use_mv_v2_evaluation", |
| 56 | "use_identity_composite_key_for_hashing", |
| 57 | "hide_sensitive_data", |
| 58 | "use_v2_feature_versioning", |
| 59 | "use_identity_overrides_in_local_eval", |
| 60 | "is_creating", |
| 61 | ) |
| 62 | read_only_fields = ( |
| 63 | "use_v2_feature_versioning", |
| 64 | "is_creating", |
| 65 | ) |
| 66 | |
| 67 | def get_use_mv_v2_evaluation(self, instance: Environment) -> bool: |
| 68 | """ |
| 69 | To avoid breaking the API, we return this field as well. |
| 70 | |
| 71 | Warning: this will still mean that sending the `use_mv_v2_evaluation` field |
| 72 | (e.g. in a PUT request) will not behave as expected but, since this is a minor |
| 73 | issue, I think we can ignore. |
| 74 | """ |
| 75 | return instance.use_identity_composite_key_for_hashing # type: ignore[no-any-return] |
| 76 | |
| 77 | |
| 78 | class EnvironmentSerializerWithMetadata( |
no outgoing calls
no test coverage detected
searching dependent graphs…