File tree Expand file tree Collapse file tree 1 file changed +72
-0
lines changed
modules/swagger-parser/src/test/java/io/swagger/parser Expand file tree Collapse file tree 1 file changed +72
-0
lines changed Original file line number Diff line number Diff line change @@ -676,4 +676,76 @@ public void testCodegenPetstore() {
676676
677677 assertEquals (formParam .getMinimum ().toString (), "32.1" );
678678 }
679+
680+ @ Test
681+ public void testCodegenIssue4555 () throws Exception {
682+ SwaggerParser parser = new SwaggerParser ();
683+ String yaml = "swagger: '2.0'\n " +
684+ "\n " +
685+ "info:\n " +
686+ " title: test\n " +
687+ " version: \" 0.0.1\" \n " +
688+ "\n " +
689+ "schemes:\n " +
690+ " - http\n " +
691+ "produces:\n " +
692+ " - application/json\n " +
693+ "\n " +
694+ "paths:\n " +
695+ " /contents/{id}:\n " +
696+ " parameters:\n " +
697+ " - name: id\n " +
698+ " in: path\n " +
699+ " description: test\n " +
700+ " required: true\n " +
701+ " type: integer\n " +
702+ "\n " +
703+ " get:\n " +
704+ " description: test\n " +
705+ " responses:\n " +
706+ " 200:\n " +
707+ " description: OK\n " +
708+ " schema:\n " +
709+ " $ref: '#/definitions/Content'\n " +
710+ "\n " +
711+ "definitions:\n " +
712+ " Content:\n " +
713+ " type: object\n " +
714+ " title: \t \t test" ;
715+ final SwaggerDeserializationResult result = parser .readWithInfo (yaml );
716+
717+ // can't parse with tabs!
718+ assertNull (result .getSwagger ());
719+ }
720+
721+ @ Test
722+ public void testIssue393 () {
723+ SwaggerParser parser = new SwaggerParser ();
724+
725+ String yaml =
726+ "swagger: '2.0'\n " +
727+ "info:\n " +
728+ " title: x\n " +
729+ " version: 1.0.0\n " +
730+ "paths:\n " +
731+ " /test:\n " +
732+ " get:\n " +
733+ " parameters: []\n " +
734+ " responses:\n " +
735+ " '400':\n " +
736+ " description: |\n " +
737+ " The account could not be created because a credential didn't meet the complexity requirements.\n " +
738+ " x-error-refs:\n " +
739+ " - '$ref': '#/x-error-defs/credentialTooShort'\n " +
740+ " - '$ref': '#/x-error-defs/credentialTooLong'\n " +
741+ "x-error-defs:\n " +
742+ " credentialTooShort:\n " +
743+ " errorID: credentialTooShort" ;
744+ final SwaggerDeserializationResult result = parser .readWithInfo (yaml );
745+
746+ assertNotNull (result .getSwagger ());
747+ Swagger swagger = result .getSwagger ();
748+
749+ assertNotNull (swagger .getVendorExtensions ().get ("x-error-defs" ));
750+ }
679751}
You can’t perform that action at this time.
0 commit comments