Skip to content

Remove required fields from evalResult swagger model#239

Merged
zhouzhuojie merged 1 commit into
masterfrom
zz/fix-eval-result-required-fields
Mar 19, 2019
Merged

Remove required fields from evalResult swagger model#239
zhouzhuojie merged 1 commit into
masterfrom
zz/fix-eval-result-required-fields

Conversation

@zhouzhuojie
Copy link
Copy Markdown
Collaborator

Description

This caused an issue under the following circumstance:

  • A flag did not exist in flagr
  • The consumer requested a flag by only specifying :flag_key
  • Flagr returned a 200 response with :flag_id omitted
  • The ruby code generated by swagger raised an ArgumentError because the response from the server was missing :flag_id

Ultimately, it's up to the consumer app anyway to decide what it requires from the server response, not the HTTP interface library.

Motivation and Context

How Has This Been Tested?

Unit test and integration tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #239 into master will decrease coverage by 1.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #239      +/-   ##
==========================================
- Coverage   83.69%   82.62%   -1.07%     
==========================================
  Files          25       25              
  Lines        1441     1439       -2     
==========================================
- Hits         1206     1189      -17     
- Misses        177      192      +15     
  Partials       58       58
Impacted Files Coverage Δ
pkg/handler/data_recorder_kinesis.go 81.57% <ø> (ø) ⬆️
pkg/handler/eval.go 77.01% <100%> (-0.27%) ⬇️
pkg/config/middleware.go 64.34% <0%> (-11.63%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82dcc45...8caac82. Read the comment docs.

}
})
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since go 1.12, monkey.PatchInstanceMethod is not working anymore, thus remove this hacky monkey patch

@zhouzhuojie
Copy link
Copy Markdown
Collaborator Author

Tested the change with rbflagr 0.1.2 (which still keeps the required fields of evalResult), looks good for the SDKs

Copy link
Copy Markdown

@erithmetic erithmetic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, we verified that if only flag_key is requested and the flag does not exist, flagr will respond with flag_id removed from the response as the serializer automatically removes items with default values.

@zhouzhuojie zhouzhuojie merged commit 7c9ffed into master Mar 19, 2019
@zhouzhuojie zhouzhuojie deleted the zz/fix-eval-result-required-fields branch March 19, 2019 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants