@@ -670,7 +670,7 @@ public void testCodegenPetstore() {
670670 assertNotNull (orderIdPathParam .getMinimum ());
671671
672672 BigDecimal minimum = orderIdPathParam .getMinimum ();
673- assertEquals (minimum .toString (), "1.0 " );
673+ assertEquals (minimum .toString (), "1" );
674674
675675 FormParameter formParam = (FormParameter )swagger .getPath ("/fake" ).getPost ().getParameters ().get (3 );
676676
@@ -689,4 +689,76 @@ public void testIssue339() throws Exception {
689689 assertTrue (pp .getMinimum ().toString ().equals ("1" ));
690690 assertTrue (pp .getMaximum ().toString ().equals ("5" ));
691691 }
692+
693+ @ Test
694+ public void testCodegenIssue4555 () throws Exception {
695+ SwaggerParser parser = new SwaggerParser ();
696+ String yaml = "swagger: '2.0'\n " +
697+ "\n " +
698+ "info:\n " +
699+ " title: test\n " +
700+ " version: \" 0.0.1\" \n " +
701+ "\n " +
702+ "schemes:\n " +
703+ " - http\n " +
704+ "produces:\n " +
705+ " - application/json\n " +
706+ "\n " +
707+ "paths:\n " +
708+ " /contents/{id}:\n " +
709+ " parameters:\n " +
710+ " - name: id\n " +
711+ " in: path\n " +
712+ " description: test\n " +
713+ " required: true\n " +
714+ " type: integer\n " +
715+ "\n " +
716+ " get:\n " +
717+ " description: test\n " +
718+ " responses:\n " +
719+ " 200:\n " +
720+ " description: OK\n " +
721+ " schema:\n " +
722+ " $ref: '#/definitions/Content'\n " +
723+ "\n " +
724+ "definitions:\n " +
725+ " Content:\n " +
726+ " type: object\n " +
727+ " title: \t \t test" ;
728+ final SwaggerDeserializationResult result = parser .readWithInfo (yaml );
729+
730+ // can't parse with tabs!
731+ assertNull (result .getSwagger ());
732+ }
733+
734+ @ Test
735+ public void testIssue393 () {
736+ SwaggerParser parser = new SwaggerParser ();
737+
738+ String yaml =
739+ "swagger: '2.0'\n " +
740+ "info:\n " +
741+ " title: x\n " +
742+ " version: 1.0.0\n " +
743+ "paths:\n " +
744+ " /test:\n " +
745+ " get:\n " +
746+ " parameters: []\n " +
747+ " responses:\n " +
748+ " '400':\n " +
749+ " description: |\n " +
750+ " The account could not be created because a credential didn't meet the complexity requirements.\n " +
751+ " x-error-refs:\n " +
752+ " - '$ref': '#/x-error-defs/credentialTooShort'\n " +
753+ " - '$ref': '#/x-error-defs/credentialTooLong'\n " +
754+ "x-error-defs:\n " +
755+ " credentialTooShort:\n " +
756+ " errorID: credentialTooShort" ;
757+ final SwaggerDeserializationResult result = parser .readWithInfo (yaml );
758+
759+ assertNotNull (result .getSwagger ());
760+ Swagger swagger = result .getSwagger ();
761+
762+ assertNotNull (swagger .getVendorExtensions ().get ("x-error-defs" ));
763+ }
692764}
0 commit comments