- ABP Framework version: v7.2.3
- UI type: Blazor
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): yes
- Exception message and stack trace:
Create a new application using suite, microservice template and add CMS administration I have configured the swagger tool as below however Azure API Gateway will not allow importing as the definition contains invalid output.
How do I get every type to be resolved
options.SwaggerDoc(apiName, new OpenApiInfo { Title = apiTitle, Version = apiVersion });
options.DocInclusionPredicate((docName, description) => true);
//options.CustomSchemaIds(type => type.FullName);
options.UseInlineDefinitionsForEnums();
options.UseAllOfToExtendReferenceSchemas();
options.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
options.IgnoreObsoleteActions();
options.IgnoreObsoleteProperties();
options.CustomSchemaIds(type => type.FullName);
One or more fields contain incorrect values:
Parsing error(s): The key 'Volo.Abp.Application.Dtos.ListResultDto1[[Volo.Abp.LanguageManagement.Dto.LanguageDto, Volo.Abp.LanguageManagement.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.ListResultDto
1[[Volo.CmsKit.Admin.Polls.PollWidgetDto, Volo.CmsKit.Pro.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.ListResultDto1[[Volo.CmsKit.Menus.MenuItemDto, Volo.CmsKit.Common.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.ListResultDto
1[[Volo.CmsKit.Public.Comments.CommentWithDetailsDto, Volo.CmsKit.Public.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.ListResultDto1[[Volo.CmsKit.Public.Reactions.ReactionWithSelectionDto, Volo.CmsKit.Public.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.Abp.AuditLogging.AuditLogDto, Volo.Abp.AuditLogging.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto1[[Volo.Abp.AuditLogging.EntityChangeDto, Volo.Abp.AuditLogging.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.Abp.LanguageManagement.Dto.LanguageDto, Volo.Abp.LanguageManagement.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto1[[Volo.Abp.LanguageManagement.Dto.LanguageTextDto, Volo.Abp.LanguageManagement.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.Abp.TextTemplateManagement.TextTemplates.TemplateDefinitionDto, Volo.Abp.TextTemplateManagement.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto1[[Volo.CmsKit.Admin.Blogs.BlogDto, Volo.CmsKit.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.CmsKit.Admin.Blogs.BlogPostListDto, Volo.CmsKit.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto1[[Volo.CmsKit.Admin.Comments.CommentWithAuthorDto, Volo.CmsKit.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.CmsKit.Admin.Menus.PageLookupDto, Volo.CmsKit.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto1[[Volo.CmsKit.Admin.Newsletters.NewsletterRecordDto, Volo.CmsKit.Pro.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.CmsKit.Admin.Pages.PageDto, Volo.CmsKit.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto1[[Volo.CmsKit.Admin.Polls.PollDto, Volo.CmsKit.Pro.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.CmsKit.Admin.UrlShorting.ShortenedUrlDto, Volo.CmsKit.Pro.Admin.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto1[[Volo.CmsKit.Contents.BlogPostCommonDto, Volo.CmsKit.Common.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9\.\-_]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto
1[[Volo.CmsKit.Tags.TagDto, Volo.CmsKit.Common.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-]+$'. [#/components] The key 'Volo.Abp.Application.Dtos.PagedResultDto`1[[Volo.CmsKit.Users.CmsUserDto, Volo.CmsKit.Common.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]' in 'schemas' of components MUST match the regular expression '^[a-zA-Z0-9.-_]+$'. [#/components]
Parsing error(s): The input OpenAPI file is not valid for the OpenAPI specification https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md (schema https://github.com/OAI/OpenAPI-Specification/blob/master/schemas/v3.0/schema.yaml).
11 Answer(s)
-
0
hi
https://support.abp.io/QA/Questions/2770/Parsing-errors-The-input-OpenAPI-file-is-not-valid-for-the-OpenAPI-specification
-
0
Hi
If you have a look at my snippet that configuration has already been applied and the issue is still occuring.
This is important as in the cloud we use API gateway instead of ocelot for on-premise so the swagger definitions need to be confirming to the openapi spec.
Thanks
-
0
hi
Can I reproduce this in app-pro template project?
abp new BookStore -t app-pro
Can you share some code and steps? Thanks
-
0
Hi
If you create a fresh application using suite, abp new BookStore -t app-pro, then add the CMS suite and start the application up.
Update the .Web as below which should fix the issue.
private void ConfigureSwaggerServices(IServiceCollection services) { services.AddAbpSwaggerGen( options => { options.SwaggerDoc("v1", new OpenApiInfo { Title = "BookStore API", Version = "v1" }); options.DocInclusionPredicate((docName, description) => true); options.UseInlineDefinitionsForEnums(); options.UseAllOfToExtendReferenceSchemas(); options.CustomSchemaIds(type => type.FullName); } ); }
If you then open the swagger definition https://localhost:44351/swagger/v1/swagger.json and look at line 7026 and many others you will see that they violate the open api specification.
"$ref": "#/components/schemas/Volo.Abp.Application.Dtos.PagedResultDto`1[[Volo.Abp.AuditLogging.EntityChangeDto, Volo.Abp.AuditLogging.Application.Contracts, Version=7.2.3.0, Culture=neutral, PublicKeyToken=null]]"
I would be happy to send you a runnable application if you drop me you email?
THanks
-
0
hi
liming.ma@volosoft.com
Thanks
-
0
hi
I downloaded your project. How can I get
Parsing error(s)
? -
0
hi
I downloaded your project. How can I get
Parsing error(s)
?If you use https://editor.swagger.io/ to validate it you will see the parsing issue
-
0
hi
Im not a swagger expert but you can try that:
options.SwaggerDoc("v1", new OpenApiInfo { Title = "BookStore API", Version = "v1" }); options.DocInclusionPredicate((docName, description) => true); options.UseInlineDefinitionsForEnums(); options.UseAllOfToExtendReferenceSchemas(); options.CustomSchemaIds(type => Regex.Replace(type.FullName, "`|=|\\[|\\]|\\s|,", ""));
-
0
Hi
No you cannot do that as it need to resolve to a type within the swagger definition. This will cause the schema to be invalid
"text/json": { "schema": { "$ref": "#/components/schemas/Volo.Abp.Application.Dtos.ListResultDto1Volo.Abp.Identity.OrganizationUnitWithDetailsDtoVolo.Abp.Identity.Pro.Application.ContractsVersion7.2.3.0CultureneutralPublicKeyTokennull" } }
-
0
hi
I don't think this is an abp problem because we just using some class as output.
I think using these classes in a plain asp net core will cause the same problem.
-
0
Ok. Will raise with ASP.NET Core team.
Thx