Skip to content
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

render empty oauth scopes #290

Merged
merged 2 commits into from May 11, 2024

Conversation

khart-twilio
Copy link
Contributor

see #289

This is my naive attempt to fix the issue. It works but it may have negative side-effects I'm not aware of.

@@ -36,6 +36,9 @@ type findValueUntyped interface {
// ToYamlNode converts the ordered map to a yaml node ready for marshalling.
func (o *Map[K, V]) ToYamlNode(n NodeBuilder, l any) *yaml.Node {
p := utils.CreateEmptyMapNode()
if o != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a small test for this, as this new block will reduced coverage, if you pull the project again and update the workflow config (upgraded the codecov action) You should see the coverage on this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I merged the latest change from main branch and ran go test -v -coverprofile cover.out ./... locally and see 100% coverage. In the status on this PR I see 1 workflow awaiting approval, which I assume means you need to approve something before the coverage check can run here, but I'm unfamiliar. I'd appreciate if you clarify for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, nevermind I was reading the test output incorrectly. I'll try to figure it out.

@khart-twilio
Copy link
Contributor Author

@daveshanley One edge case I noticed when testing:

I had:

...
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: null # null isn't allowed here I don't think according to the spec

And with these changes in libopenapi it is now being processed and spit out as

...
                properties:
                  value:
                    type: "ObjectNode"

It doesn't matter for this case since using null was invalid and I changed it to something else, but I'm wondering if it might matter in other places. I'm not familiar with how things like null, true, false come through as yaml.Node object when deserialized and if I'd need to handle these cases in the changes.

Copy link

codecov bot commented May 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.62%. Comparing base (0e74598) to head (2ba004f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #290   +/-   ##
=======================================
  Coverage   99.62%   99.62%           
=======================================
  Files         162      162           
  Lines       16075    16077    +2     
=======================================
+ Hits        16014    16016    +2     
  Misses         56       56           
  Partials        5        5           
Flag Coverage Δ
unittests 99.62% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@daveshanley
Copy link
Member

@daveshanley One edge case I noticed when testing:

I had:

...
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: null # null isn't allowed here I don't think according to the spec

And with these changes in libopenapi it is now being processed and spit out as

...
                properties:
                  value:
                    type: "ObjectNode"

It doesn't matter for this case since using null was invalid and I changed it to something else, but I'm wondering if it might matter in other places. I'm not familiar with how things like null, true, false come through as yaml.Node object when deserialized and if I'd need to handle these cases in the changes.

I have no idea where ObjectNode is coming from. It's not part of libopenapi

Because I have no idea, let's just proceed, if someone else finds this issue then we can investigate further.

@daveshanley daveshanley merged commit a4a9370 into pb33f:main May 11, 2024
4 checks passed
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.

None yet

2 participants