-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to build with latest exp sort #985
Comments
I am seeing this same error in 1.71.1. To reproduce what I'm seeing git clone [email protected]:Senzing/go-rest-api-service.git
cd go-rest-api-service
git checkout 934f407
make test The documentation on how I generated the files is at https://github.com/Senzing/go-rest-api-service/blob/934f407beb27f54c72cf8698e0ada59fc43edee5/docs/development.md |
It seems API of ogen requires: Line 22 in 2f8b4fa
|
@ernado With 0.72.0 I'm getting these new errors: === RUN TestAddRecordReq_Examples/Test1
oas_test_examples_gen_test.go:176:
Error Trace: /home/senzing/senzing.git/go-rest-api-service/senzingrestapi/oas_test_examples_gen_test.go:176
Error: Received unexpected error:
decode AddRecordReq:
github.com/senzing/go-rest-api-service/senzingrestapi.(*AddRecordReq).Decode
/home/senzing/senzing.git/go-rest-api-service/senzingrestapi/oas_json_gen.go:339
- "{" expected:
github.com/go-faster/jx.(*Decoder).ObjBytes
/home/senzing/go/pkg/mod/github.com/go-faster/[email protected]/dec_obj.go:12
- unexpected byte 34 '"' at 0
Test: TestAddRecordReq_Examples/Test1
Messages: Input: "{\n \"NAMES\": [\n {\n \"NAME_FIRST\": \"JANE\",\n \"NAME_LAST\": \"SCHMOE\"\n }\n ],\n \"PHONE_NUMBERS\": [\n {\n \"PHONE_NUMBER\": \"559-555-1212\"\n }\n ],\n \"ADDRESSES\": [\n {\n \"ADDR_LINE1\": \"653 STATE ROUTE 7\",\n \"ADDR_CITY\": \"FRESNO\",\n \"ADDR_STATE\": \"CA\",\n \"ADDR_POSTAL_CODE\": \"55073-1234\"\n }\n ]\n}"
|
The generated testcase: func TestAddRecordReq_Examples(t *testing.T) {
for i, tc := range []struct {
Input string
}{
{Input: "\"{\\n \\\"NAMES\\\": [\\n {\\n \\\"NAME_FIRST\\\": \\\"JANE\\\",\\n \\\"NAME_LAST\\\": \\\"SCHMOE\\\"\\n }\\n ],\\n \\\"PHONE_NUMBERS\\\": [\\n {\\n \\\"PHONE_NUMBER\\\": \\\"559-555-1212\\\"\\n }\\n ],\\n \\\"ADDRESSES\\\": [\\n {\\n \\\"ADDR_LINE1\\\": \\\"653 STATE ROUTE 7\\\",\\n \\\"ADDR_CITY\\\": \\\"FRESNO\\\",\\n \\\"ADDR_STATE\\\": \\\"CA\\\",\\n \\\"ADDR_POSTAL_CODE\\\": \\\"55073-1234\\\"\\n }\\n ]\\n}\""},
{Input: "\"{\\n \\\"NAMES\\\": [\\n {\\n \\\"NAME_TYPE\\\": \\\"PRIMARY\\\",\\n \\\"NAME_FIRST\\\": \\\"JANE\\\",\\n \\\"NAME_LAST\\\": \\\"SCHMOE\\\"\\n },\\n {\\n \\\"NAME_TYPE\\\": \\\"MAIDEN\\\",\\n \\\"NAME_FIRST\\\": \\\"JANE\\\",\\n \\\"NAME_LAST\\\": \\\"SMITH\\\"\\n }\\n ],\\n \\\"PHONE_NUMBERS\\\": [\\n {\\n \\\"PHONE_TYPE\\\": \\\"HOME\\\",\\n \\\"PHONE_NUMBER\\\": \\\"559-555-1212\\\"\\n },\\n {\\n \\\"PHONE_TYPE\\\": \\\"WORK\\\",\\n \\\"PHONE_NUMBER\\\": \\\"559-555-1414\\\"\\n }\\n ],\\n \\\"ADDRESSES\\\": [\\n {\\n \\\"ADDR_TYPE\\\": \\\"HOME\\\",\\n \\\"ADDR_LINE1\\\": \\\"653 STATE ROUTE 7\\\",\\n \\\"ADDR_CITY\\\": \\\"FRESNO\\\",\\n \\\"ADDR_STATE\\\": \\\"CA\\\",\\n \\\"ADDR_POSTAL_CODE\\\": \\\"55073-1234\\\"\\n },\\n {\\n \\\"ADDR_TYPE\\\": \\\"WORK\\\",\\n \\\"ADDR_LINE1\\\": \\\"701 E MAIN STREET\\\",\\n \\\"ADDR_CITY\\\": \\\"FOWLER\\\",\\n \\\"ADDR_STATE\\\": \\\"CA\\\",\\n \\\"ADDR_POSTAL_CODE\\\": \\\"93625\\\"\\n }\\n ]\\n}\""},
{Input: "\"{\\n \\\"NAME_FIRST\\\": \\\"JANE\\\",\\n \\\"NAME_LAST\\\": \\\"SCHMOE\\\",\\n \\\"HOME_PHONE_NUMBER\\\": \\\"559-555-1212\\\",\\n \\\"WORK_PHONE_NUMBER\\\": \\\"559-555-1414\\\",\\n \\\"HOME_ADDR_LINE1\\\": \\\"653 STATE ROUTE 7\\\",\\n \\\"HOME_ADDR_CITY\\\": \\\"FRESNO\\\",\\n \\\"HOME_ADDR_STATE\\\": \\\"CA\\\",\\n \\\"HOME_ADDR_POSTAL_CODE\\\": \\\"55073-1234\\\"\\n \\\"WORK_ADDR_LINE1\\\": \\\"701 E MAIN STREET\\\",\\n \\\"WORK_ADDR_CITY\\\": \\\"FOWLER\\\",\\n \\\"WORK_ADDR_STATE\\\": \\\"CA\\\",\\n \\\"WORK_ADDR_POSTAL_CODE\\\": \\\"93625\\\"\\n}\""},
{Input: "\"{\\n \\\"NAME_FIRST\\\": \\\"JANE\\\",\\n \\\"NAME_LAST\\\": \\\"SCHMOE\\\",\\n \\\"PHONE_NUMBER\\\": \\\"559-555-1212\\\",\\n \\\"ADDR_LINE1\\\": \\\"653 STATE ROUTE 7\\\",\\n \\\"ADDR_CITY\\\": \\\"FRESNO\\\",\\n \\\"ADDR_STATE\\\": \\\"CA\\\",\\n \\\"ADDR_POSTAL_CODE\\\": \\\"55073-1234\\\"\\n}\""},
} {
tc := tc
t.Run(fmt.Sprintf("Test%d", i+1), func(t *testing.T) {
var typ AddRecordReq
typ = make(AddRecordReq)
if err := typ.Decode(jx.DecodeStr(tc.Input)); err != nil {
if validateErr, ok := errors.Into[*validate.Error](err); ok {
t.Skipf("Validation error: %v", validateErr)
return
}
require.NoErrorf(t, err, "Input: %s", tc.Input)
}
e := jx.Encoder{}
typ.Encode(&e)
require.True(t, std.Valid(e.Bytes()), "Encoded: %s", e.Bytes())
var typ2 AddRecordReq
typ2 = make(AddRecordReq)
require.NoError(t, typ2.Decode(jx.DecodeBytes(e.Bytes())))
})
}
} |
To recreate: git clone [email protected]:Senzing/go-rest-api-service.git
cd go-rest-api-service
git checkout 1183ad6
make test |
@docktermj It's a generated test for spec examples. Probably somewhere in spec example set as a string literal, not an object. |
@docktermj |
@ernado That does fix it (because the test isn't there). Am I exposing my code to issues without those tests? That is, will the code that uses the generated code have the same issues that the test did? |
I think that it is test-only issue and you can create a new isolated issue for this bug. |
What version of ogen are you using?
1.71.1
Can this issue be reproduced with the latest version?
Yes
What did you do?
Build ogen with latest exp
related history : https://cs.opensource.google/go/x/exp/+/master:slices/sort.go;bpv=1;bpt=0;drc=302865e7556b4ae5de27248ce625d443ef4ad3ed;dlc=864b3d6c5c2c5ebc4e14047a4975d8acde58bca6
What did you expect to see?
build without error
What did you see instead?
The text was updated successfully, but these errors were encountered: