Commit 0f1cf25
Prevent setting method_name in Operation constructor (#41)
The method_name field should be automatically set by the framework to
match the attribute name in service definitions or the method name in
operation handlers. Users should not be able to set it directly.
Changes:
- Add init=False to method_name field in Operation dataclass
- Update framework code to set method_name after Operation construction
- Keep validation to catch manual method_name assignment that doesn't
match the attribute name
- Remove test case for duplicate method names via constructor (that
specific scenario is no longer possible)
- Update test expectations to not pass method_name to constructor
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 4f7b9d4 commit 0f1cf25
File tree
4 files changed
+21
-58
lines changed- src/nexusrpc
- handler
- tests/handler
4 files changed
+21
-58
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
143 | 142 | | |
144 | 143 | | |
145 | 144 | | |
146 | | - | |
147 | 145 | | |
148 | 146 | | |
149 | 147 | | |
| 148 | + | |
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
| |||
287 | 286 | | |
288 | 287 | | |
289 | 288 | | |
290 | | - | |
291 | 289 | | |
292 | 290 | | |
293 | 291 | | |
| |||
311 | 309 | | |
312 | 310 | | |
313 | 311 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | 312 | | |
321 | | - | |
322 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
323 | 320 | | |
324 | 321 | | |
325 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
185 | 181 | | |
| 182 | + | |
| 183 | + | |
186 | 184 | | |
187 | 185 | | |
188 | 186 | | |
| |||
278 | 276 | | |
279 | 277 | | |
280 | 278 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
289 | 283 | | |
| 284 | + | |
| 285 | + | |
290 | 286 | | |
291 | 287 | | |
292 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | 127 | | |
151 | 128 | | |
152 | 129 | | |
| |||
189 | 166 | | |
190 | 167 | | |
191 | 168 | | |
192 | | - | |
193 | 169 | | |
194 | 170 | | |
195 | 171 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
| |||
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | | - | |
81 | 78 | | |
82 | 79 | | |
83 | 80 | | |
| |||
95 | 92 | | |
96 | 93 | | |
97 | 94 | | |
98 | | - | |
99 | 95 | | |
100 | 96 | | |
101 | 97 | | |
| |||
115 | 111 | | |
116 | 112 | | |
117 | 113 | | |
118 | | - | |
119 | 114 | | |
120 | 115 | | |
121 | 116 | | |
| |||
137 | 132 | | |
138 | 133 | | |
139 | 134 | | |
140 | | - | |
141 | 135 | | |
142 | 136 | | |
143 | 137 | | |
| |||
0 commit comments