Skip to content

Commit 175a5dd

Browse files
Merge branch 'master' into clean-pydantic-model-dump-warnings
2 parents 95aa591 + 0d04169 commit 175a5dd

File tree

134 files changed

+1851
-1773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+1851
-1773
lines changed

api/specs/web-server/_catalog.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from fastapi import APIRouter, Depends
44
from models_library.api_schemas_api_server.pricing_plans import ServicePricingPlanGet
55
from models_library.api_schemas_webserver.catalog import (
6+
CatalogLatestServiceGet,
67
CatalogServiceGet,
7-
CatalogServiceListItem,
88
CatalogServiceUpdate,
99
ServiceInputGet,
1010
ServiceInputKey,
@@ -34,10 +34,9 @@
3434

3535
@router.get(
3636
"/catalog/services/-/latest",
37-
response_model=Page[CatalogServiceListItem],
37+
response_model=Page[CatalogLatestServiceGet],
3838
)
39-
def list_services_latest(_query: Annotated[ListServiceParams, Depends()]):
40-
pass
39+
def list_services_latest(_query: Annotated[ListServiceParams, Depends()]): ...
4140

4241

4342
@router.get(

docs/messages-guidelines.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Error and Warning Message Guidelines
2+
3+
These guidelines ensure that messages are user-friendly, clear, and helpful while maintaining a professional tone. 🚀
4+
5+
Some details:
6+
7+
- Originated from [guidelines](https://wiki.speag.com/projects/SuperMash/wiki/Concepts/GUI) by @eofli and refined iterating with AI
8+
- Here’s the fully expanded and rewritten list of **error and warning message guidelines**, each with:
9+
- A **guideline**
10+
- A **rationale**
11+
- A ❌ **bad example**
12+
- A ✅ **good example**
13+
- A **reference**
14+
- This list is intended to be short enough to be read and understood for humans as well as complete so that it can be used as context for automatic correction of error/warning messages
15+
16+
---
17+
18+
## 1. Be Clear and Concise
19+
20+
- **Guideline:** Use straightforward language to describe the issue without unnecessary words.
21+
- **Rationale:** Users can quickly understand the problem and take corrective action when messages are simple and to the point.
22+
-**Bad Example:**
23+
`"An error has occurred due to an unexpected input that couldn't be parsed correctly."`
24+
-**Good Example:**
25+
`"We couldn't process your request. Please check your input and try again."`
26+
- **[Reference](https://uxwritinghub.com/error-message-examples/)**
27+
28+
---
29+
30+
## 2. Provide Specific and Actionable Information
31+
32+
- **Guideline:** Clearly state what went wrong and how the user can fix it.
33+
- **Rationale:** Specific guidance helps users resolve issues efficiently, reducing frustration.
34+
-**Bad Example:**
35+
`"Something went wrong."`
36+
-**Good Example:**
37+
`"Your session has expired. Please log in again to continue."`
38+
- **[Reference](https://www.nngroup.com/articles/error-message-guidelines/)**
39+
40+
---
41+
42+
## 3. Avoid Technical Jargon
43+
44+
- **Guideline:** Use plain language instead of technical terms or codes.
45+
- **Rationale:** Non-technical users may not understand complex terminology, hindering their ability to resolve the issue.
46+
-**Bad Example:**
47+
`"Error 429: Too many requests per second."`
48+
-**Good Example:**
49+
`"You’ve made too many requests. Please wait a moment and try again."`
50+
- **[Reference](https://cxl.com/blog/error-messages/)**
51+
52+
---
53+
54+
## 4. Use a Polite and Non-Blaming Tone
55+
56+
- **Guideline:** Frame messages in a way that doesn't place blame on the user.
57+
- **Rationale:** A respectful tone maintains a positive user experience and encourages users to continue using the application.
58+
-**Bad Example:**
59+
`"You entered the wrong password."`
60+
-**Good Example:**
61+
`"The password doesn't match. Please try again."`
62+
- **[Reference](https://atlassian.design/content/writing-guidelines/writing-error-messages/)**
63+
64+
---
65+
66+
## 5. Avoid Negative Words and Phrases
67+
68+
- **Guideline:** Steer clear of words like "error," "failed," "invalid," or "illegal."
69+
- **Rationale:** Positive language reduces user anxiety and creates a more supportive experience.
70+
-**Bad Example:**
71+
`"Invalid email address."`
72+
-**Good Example:**
73+
`"The email address format doesn't look correct. Please check and try again."`
74+
- **[Reference](https://atlassian.design/content/writing-guidelines/writing-error-messages/)**
75+
76+
---
77+
78+
## 6. Place Messages Appropriately
79+
80+
- **Guideline:** Display error messages near the relevant input field or in a clear, noticeable location.
81+
- **Rationale:** Proper placement ensures users notice the message and understand where the issue occurred.
82+
-**Bad Example:**
83+
Showing a generic "Form submission failed" message at the top of the page.
84+
-**Good Example:**
85+
Placing "Please enter a valid phone number" directly below the phone input field.
86+
- **[Reference](https://www.smashingmagazine.com/2022/08/error-messages-ux-design/)**
87+
88+
---
89+
90+
## 7. Use Inline Validation When Possible
91+
92+
- **Guideline:** Provide real-time feedback as users interact with input fields.
93+
- **Rationale:** Inline validation allows users to correct errors immediately, enhancing the flow and efficiency of the interaction.
94+
-**Bad Example:**
95+
Waiting until form submission to show all validation errors.
96+
-**Good Example:**
97+
Displaying "Password must be at least 8 characters" while the user types.
98+
- **[Reference](https://cxl.com/blog/error-messages/)**
99+
100+
---
101+
102+
## 8. Avoid Using All-Caps and Excessive Punctuation
103+
104+
- **Guideline:** Refrain from writing messages in all capital letters or using multiple exclamation marks.
105+
- **Rationale:** All-caps and excessive punctuation can be perceived as shouting, which may frustrate users.
106+
-**Bad Example:**
107+
`"INVALID INPUT!!!"`
108+
-**Good Example:**
109+
`"This input doesn't look correct. Please check and try again."`
110+
- **[Reference](https://uxwritinghub.com/error-message-examples/)**
111+
112+
---
113+
114+
## 9. Use Humor Sparingly
115+
116+
- **Guideline:** Incorporate light-hearted language only when appropriate and aligned with the application's tone.
117+
- **Rationale:** While humor can ease tension, it may not be suitable for all users or situations and can sometimes be misinterpreted.
118+
-**Bad Example:**
119+
`"Oopsie daisy! You broke something!"`
120+
-**Good Example:**
121+
`"Something went wrong. Try again, or contact support if the issue continues."`
122+
- **[Reference](https://cxl.com/blog/error-messages/)**
123+
124+
---
125+
126+
## 10. Offer Alternative Solutions or Support
127+
128+
- **Guideline:** If the user cannot resolve the issue independently, provide a way to contact support or access help resources.
129+
- **Rationale:** Offering support options ensures users don't feel stranded and can seek help to resolve their issues.
130+
-**Bad Example:**
131+
`"Access denied."`
132+
-**Good Example:**
133+
`"You don't have permission to view this page. Contact support if you think this is a mistake."`
134+
- **[Reference](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-error-handling-guidelines/)**

packages/models-library/src/models_library/api_schemas_catalog/services.py

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,15 @@ class _BaseServiceGetV2(CatalogOutputSchema):
202202

203203
access_rights: dict[GroupID, ServiceGroupAccessRightsV2] | None
204204

205-
classifiers: list[str] | None = []
206-
quality: dict[str, Any] = {}
205+
classifiers: Annotated[
206+
list[str] | None,
207+
Field(default_factory=list),
208+
] = DEFAULT_FACTORY
209+
210+
quality: Annotated[
211+
dict[str, Any],
212+
Field(default_factory=dict),
213+
] = DEFAULT_FACTORY
207214

208215
model_config = ConfigDict(
209216
extra="forbid",
@@ -212,6 +219,34 @@ class _BaseServiceGetV2(CatalogOutputSchema):
212219
)
213220

214221

222+
class LatestServiceGet(_BaseServiceGetV2):
223+
release: Annotated[
224+
ServiceRelease,
225+
Field(description="release information of current (latest) service"),
226+
]
227+
228+
@staticmethod
229+
def _update_json_schema_extra(schema: JsonDict) -> None:
230+
schema.update(
231+
{
232+
"examples": [
233+
{
234+
**_EXAMPLE_SLEEPER, # v2.2.1 (latest)
235+
"release": {
236+
"version": _EXAMPLE_SLEEPER["version"],
237+
"version_display": "Summer Release",
238+
"released": "2025-07-20T15:00:00",
239+
},
240+
}
241+
]
242+
}
243+
)
244+
245+
model_config = ConfigDict(
246+
json_schema_extra=_update_json_schema_extra,
247+
)
248+
249+
215250
class ServiceGetV2(_BaseServiceGetV2):
216251
# Model used in catalog's rpc and rest interfaces
217252
history: Annotated[
@@ -235,7 +270,7 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
235270
{
236271
"version": _EXAMPLE_SLEEPER["version"],
237272
"version_display": "Summer Release",
238-
"released": "2024-07-20T15:00:00",
273+
"released": "2024-07-21T15:00:00",
239274
},
240275
{
241276
"version": "2.0.0",
@@ -263,7 +298,7 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
263298
},
264299
{
265300
"version": "0.9.0",
266-
"retired": "2024-07-20T15:00:00",
301+
"retired": "2024-07-20T16:00:00",
267302
},
268303
{"version": "0.8.0"},
269304
{"version": "0.1.0"},
@@ -288,21 +323,9 @@ def _update_json_schema_extra(schema: JsonDict) -> None:
288323
)
289324

290325

291-
class ServiceListItem(_BaseServiceGetV2):
292-
history: Annotated[
293-
list[ServiceRelease],
294-
Field(
295-
default_factory=list,
296-
deprecated=True,
297-
description="History will be replaced by current 'release' instead",
298-
json_schema_extra={"default": []},
299-
),
300-
] = DEFAULT_FACTORY
301-
302-
303326
PageRpcServicesGetV2: TypeAlias = PageRpc[
304327
# WARNING: keep this definition in models_library and not in the RPC interface
305-
ServiceListItem
328+
LatestServiceGet
306329
]
307330

308331
ServiceResourcesGet: TypeAlias = ServiceResourcesDict

0 commit comments

Comments
 (0)