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

Incorrect data-type errors for valid response examples #429

Closed
mmcmasterd3 opened this issue Nov 12, 2019 · 20 comments
Closed

Incorrect data-type errors for valid response examples #429

mmcmasterd3 opened this issue Nov 12, 2019 · 20 comments
Milestone

Comments

@mmcmasterd3
Copy link

Errors are thrown if a response example is given for a string property defined in a schema that also happens to parse as a number.

The following produces the error Data and type mismatch found. [#/paths/~1test/get/responses/200/content/application~1json/example/BrokenProperty]

openapi: 3.0.1
info:
  title: BrokenFunction
  description: This will not parse 
  version: '1.0'
paths:
  '/test':
    get:
      summary: GetTest
      operationId: getTest
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Example'
              example:
                BrokenProperty: '1234'

components:
  schemas:
    Example:
      type: object
      properties:
        BrokenProperty:
          type: string
          description: Customer Identifier
@darrelmiller
Copy link
Member

Thanks for the bug report. @VitaliyKurokhtin has a PR #431 that will fix this.

@jason-runzer
Copy link

Hi @darrelmiller , is there any eta when 1.2.0 is going to be released? I am also having this issue with my examples when importing into the UI.

@darrelmiller
Copy link
Member

darrelmiller commented Feb 7, 2020 via email

@jason-runzer
Copy link

That would be great! Thanks.

@Robzilla
Copy link

I am also getting this when trying to import an open api 3.0.1 into the Azure API Management portal. Can I get an ETA on this? Over 3 months now and the impact quite large.

@kimpenhaus
Copy link

same on our side - we had to change lots of exampleprovider just to make it work. all those example provider now showing grammatically wrong data.

thanks!

@Robzilla
Copy link

Good find. The date parse breaks for me but used to work a few weeks ago. How did this get into production if the test is failing?

@darrelmiller
Copy link
Member

darrelmiller commented Feb 17, 2020

I have removed the example data validation from the default set of validators in 1.2.0. This is not validation can be done during parsing and is not required by the specification. It was also a mistake to try and strongly type the examples during parsing. I'm not sure how we are going to fix in this in a non-breaking way.

@Robzilla
Copy link

Robzilla commented Feb 23, 2020

Guys I am trying to update an API that is in Azure API management that I previously deployed a few weeks ago. Now I am getting the incorrect data-type error for date examples when importing an updated api definition. Some of which are mandatory fields. The api definition passes validation in Swaggerhub fine. Now I have to demo the api to a client in 2 days using the Azure API developer portal but the API definitions are old and I can't update them. So I am asking for an Eta for a fix. The client keeps asking if we can move to AWS. Might have to look seriously at doing that if this isn't working soon.

@VitaliyKurokhtin
Copy link
Contributor

@Robzilla, technically this is not the place to discuss APIM issues. Feel free to open support ticket with description if the issue, there've been a couple of known ones for which general resolution is pending but we can speed things up for your service.

@Robzilla
Copy link

Seriously, the API M guys say talk to the Open API guys and the Open API guys say talk to the API M guys. Regressing functionality in a major product offering seriously degrades confidence in MS. Can anyone offer an Eta on a fix. This functionality used to work. Just roll back the broken build.

@darrelmiller
Copy link
Member

@Robzilla VitaliyK is an APIM guy :-) I believe APIM is currently working off a forked build of OpenAPI.NET so that they are not blocked by my slow release process. I did a bunch of testing on 1.2.0 on the weekend and there are still some bugs I need to fix before we can come out of preview. That will remove the data validations by default.
The change to make the example just parsed as a string will likely be a breaking change so it will have to go out in 2.0 release. That's going to take a bit more planning.

@VitaliyKurokhtin
Copy link
Contributor

@Robzilla, Really not sure why would anyone direct you to OpenAPI.NET, no matter where the issue is - APIM or OpenAPI.NET - it's not like you can fix it in either place. Event if you make a fix to OpenAPI.NET yourself you can't integrate it into APIM. So that definitely wasn't fair.

As it always goes with these things, this issue only affects some of our customers, so we're doing retakes on service by service basis. Another APIM release is ongoing right now with this fix and other changes, ETA for when it reaches your service varies depending on its region, at most it may take a week if all goes well. But if you share your service name I'll be able to apply fix almost immediately. If you're not comfortable sharing it here, please, do open a support ticket it'll reach us and I'll apply the fix.

@Robzilla
Copy link

@VitaliyKurokhtin here is the link from the issue in the API Management Portal thread where the issue was first reported (to my knowledge) last November. @DrReedo advises to raise the issue here.
(Azure/api-management-developer-portal#294 (comment))
If this is incorrect where should this issue be raised?
As for the fix rollout, I am currently deploying to the Australia East data centre. Any idea when the fix will reach there?

@VitaliyKurokhtin
Copy link
Contributor

Reporting issue originally to api-management-developer-portal portal was the right move on your side, since you being outside of the product cannot know whether the issue is in portal or on APIM server side. Once issue was identified to be not in portal asking you to direct it here was incorrect in my opinion.

The bug is indeed in OpenAPI.NET and APIM uses this library to facilitate OpenAPI import. But as I said above it's not like you or anyone maintaining OpenAPI.NET can affect what is being done inside APIM. The best they can do is communicate issue to us just because we happen to know each other. So the best way to raise any issues with any Microsoft maintained service is to open a support ticket.

@Robzilla
Copy link

@VitaliyKurokhtin
As for the fix rollout, I am currently deploying to the Australia East data centre. Any idea when the fix will reach there?

@VitaliyKurokhtin
Copy link
Contributor

@Robzilla, fix should reach Australia East as a part of next update next week.

@varghgeorge
Copy link

Any updates on this issue? Not able to add APIs to Azure now.

@darrelmiller
Copy link
Member

The 1.2 release will be able to validate an example in the Schema object, but it will not be able to validate the example in the media type object. Users should no longer see failures due to incorrect validation logic in the 1.2 release.

@pacharanero
Copy link

I am having the same issue - a valid (tested elsewhere), autogenerated. openAPI3 spec is being rejected by Azure.

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

No branches or pull requests

8 participants