blackmo18/kotlin-grass

Ignore unknown fields

winterhate opened this issue · 1 comments

There should be a switch to allow ignore unmaped fields in input data.

            "parse to primitive data type with unmapped field" {
                val expected =
                    PrimitiveTypes(0, 1, 2, 3.0f, 4.0, true, "hello")
                val contents = readTestFile("/primitive-with-unmapped-field.csv").asSequence()
                val grass = grass<PrimitiveTypes>() {
                    ignoreUnknownFields = true
                }
                val parsed = grass.harvest(contents)
                val actual = parsed.first()

                assertTrue { expected == actual }
            }

where primitive-with-unmapped-field.csv is

short,int,long,float,double,boolean,string,unmapped
0,1,2,3.0,4.0,true,hello,unmapped1
5,6,7,8.0,9.0,true,hi,unmapped2

@blackmo18 I already implemented the feature, but I am unable to push the branch for review due to insufficient permissions:

12:05:33.738: [kotlin-grass] git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/enhancement/ignore-unknown-field-option:enhancement/ignore-unknown-field-option --set-upstream
remote: Permission to blackmo18/kotlin-grass.git denied to winterhate.
fatal: unable to access 'https://github.com/blackmo18/kotlin-grass.git/': The requested URL returned error: 403

@winterhate, may you create a pull request from your fork and create a pull request?