Skip to content

Incorrect data-type errors for valid response examples #429

Closed

Description

@mmcmasterd3

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

Activity

  1. darrelmiller commented on Dec 7, 2019

    @darrelmiller
    Member

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

  2. added this to the 1.2.0 milestone on Dec 7, 2019
  3. jason-runzer commented on Feb 7, 2020

    @jason-runzer

    Hi Darrel (@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.

  4. darrelmiller commented on Feb 7, 2020

    @darrelmiller
    Member
  5. jason-runzer commented on Feb 7, 2020

    @jason-runzer

    That would be great! Thanks.

  6. Robzilla commented on Feb 16, 2020

    @Robzilla

    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.

  7. kimpenhaus commented on Feb 16, 2020

    @kimpenhaus

    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!

  8. Robzilla commented on Feb 17, 2020

    @Robzilla

    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?

  9. darrelmiller commented on Feb 17, 2020

    @darrelmiller
    Member

    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.

  10. Robzilla commented on Feb 23, 2020

    @Robzilla

    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.

  11. VitaliyKurokhtin commented on Feb 24, 2020

    @VitaliyKurokhtin
    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.

  12. Robzilla commented on Feb 25, 2020

    @Robzilla

    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.

  13. darrelmiller commented on Feb 25, 2020

    @darrelmiller
    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.

  14. VitaliyKurokhtin commented on Feb 25, 2020

    @VitaliyKurokhtin
    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.

  15. Robzilla commented on Feb 26, 2020

    @Robzilla

    Vitaliy Kurokhtin (@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?

  16. VitaliyKurokhtin commented on Feb 26, 2020

    @VitaliyKurokhtin
    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.

  17. Robzilla commented on Feb 27, 2020

    @Robzilla

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

  18. VitaliyKurokhtin commented on Feb 27, 2020

    @VitaliyKurokhtin
    Contributor

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

  19. varghgeorge commented on Mar 16, 2020

    @varghgeorge

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

  20. darrelmiller commented on Apr 2, 2020

    @darrelmiller
    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.

  21. pacharanero commented on Mar 20, 2021

    @pacharanero

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions