Skip to content

Commit 3983ace

Browse files
author
Ruben van Leeuwen
committed
1954: Adds changeset
1 parent ca575dc commit 3983ace

File tree

3 files changed

+45
-36
lines changed

3 files changed

+45
-36
lines changed

backend/main.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def example_backend_validation(val: int) -> bool:
8080

8181
NumberExample = Annotated[
8282
int,
83-
Ge(18),
83+
Ge(8),
8484
Le(99),
8585
MultipleOf(multiple_of=3),
8686
Predicate(example_backend_validation),
@@ -165,61 +165,61 @@ def form_generator(state: State):
165165
class TestForm0(FormPage):
166166
model_config = ConfigDict(title="Form Title Page 1")
167167

168-
number: NumberExample
169-
list: TestExampleNumberList
170-
# list_list: unique_conlist(TestExampleNumberList, min_items=1, max_items=5)
171-
# list_list_list: unique_conlist(
172-
# unique_conlist(Person2, min_items=1, max_items=5),
173-
# min_items=1,
174-
# max_items=2,
175-
# ) = [1, 2]
176-
test: TestString
177-
textList: unique_conlist(TestString, min_items=1, max_items=5)
178-
# numberList: TestExampleNumberList = [1, 2]
179-
person: Person2
180-
personList: unique_conlist(Person2, min_items=2, max_items=5)
181-
# ingleNumber: NumberExample
182-
# number0: Annotated[int, Ge(18), Le(99)] = 17
168+
number: NumberExample = ["1", "2", "3"]
169+
personList: TestPersonList
183170

184171
form_data_0 = yield TestForm0
185172

186173
class TestForm1(FormPage):
187174
model_config = ConfigDict(title="Form Title Page 1")
188175

189-
contact_name2: StringExample
176+
contact_name2: TestString = "RRR"
190177
options: ListChoices
191178

192179
form_data_1 = yield TestForm1
193180

194-
class TestForm2(FormPage):
181+
class TestForm2(SubmitFormPage):
195182
model_config = ConfigDict(title="Form Title Page 2")
196183

197-
contact_name3: StringExample
184+
contact_name3: TestString = "Ruben"
198185
age: NumberExample
199186

200187
form_data_2 = yield TestForm2
201188

202-
class TestForm3(FormPage):
203-
model_config = ConfigDict(title="Form Title Page 3")
204-
205-
contact_person: Person
206-
207-
form_data_3 = yield TestForm3
208-
209-
class TestForm5(FormPage):
210-
model_config = ConfigDict(title="Form Title Page 4")
211-
212-
contact_person_list: TestPersonList
213-
214-
form_data_5 = yield TestForm5
215-
216189
return (
217190
form_data_0.model_dump()
218191
| form_data_1.model_dump()
219192
| form_data_2.model_dump()
220-
| form_data_3.model_dump()
221-
| form_data_5.model_dump()
222193
)
223194

224195
post_form(form_generator, state={}, user_inputs=form_data)
225196
return "OK!"
197+
198+
# list: TestExampleNumberList
199+
# list_list: unique_conlist(TestExampleNumberList, min_items=1, max_items=5)
200+
# list_list_list: unique_conlist(
201+
# unique_conlist(Person2, min_items=1, max_items=5),
202+
# min_items=1,
203+
# max_items=2,
204+
# ) = [1, 2]
205+
# test: TestString
206+
# textList: unique_conlist(TestString, min_items=1, max_items=5)
207+
# numberList: TestExampleNumberList = [1, 2]
208+
# person: Person2
209+
# personList: unique_conlist(Person2, min_items=2, max_items=5)
210+
# ingleNumber: NumberExample
211+
# number0: Annotated[int, Ge(18), Le(99)] = 17
212+
213+
# class TestForm3(FormPage):
214+
# model_config = ConfigDict(title="Form Title Page 3")
215+
216+
# contact_person: Person
217+
218+
# form_data_3 = yield TestForm3
219+
220+
# class TestForm5(FormPage):
221+
# model_config = ConfigDict(title="Form Title Page 4")
222+
223+
# contact_person_list: TestPersonList
224+
225+
# form_data_5 = yield TestForm5
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'pydantic-forms': patch
3+
---
4+
5+
Fixes getFormFieldValue to handle arrayItem fields better

frontend/apps/example/src/app/page.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ export default function Home() {
2121
const pydanticFormApiProvider: PydanticFormApiProvider = async ({
2222
requestBody,
2323
}) => {
24-
const fetchResult = await fetch('http://localhost:8000/form', {
24+
const portsUrl =
25+
'https://orchestrator.dev.automation.surf.net/api/processes/create_sn8_service_port?productId=9a8bd1ea-6650-4900-b820-3c7f0f16ef1d';
26+
const localUrl = 'http://localhost:8000/form';
27+
const fetchResult = await fetch(localUrl, {
2528
method: 'POST',
2629
headers: {
2730
'Content-Type': 'application/json',
31+
Authorization: 'Bearer INSERT_YOUR_JWT_TOKEN_HERE', // Replace with your JWT token
2832
},
2933
body: JSON.stringify(requestBody),
3034
});

0 commit comments

Comments
 (0)