0

Can I use nswag but providing my own json schemas for the data types? How do I do this, there are multiple files? I am also attempting to use embedded resources as the source from a shared library. Using .net framework.

Tried using type-mapper but references kind of broke swagger gui https://github.com/RicoSuter/NJsonSchema/wiki/Type-Mappers

settings.GeneratorSettings.TypeMappers.Add(new NJsonSchema.Generation.TypeMappers.ObjectTypeMapper(typeof(OutputRoot), OutputRootSchema));

If this is correct way, where can I read more about it & how to troubleshoot it.

llarsson
  • 33
  • 7
  • What is OutputRootSchema? – Rico Suter Feb 12 '20 at 21:58
  • A jsonschema e.g. embedded resource or from file. Conceptually "Object type mapper"/second section in link. But the general question is still - I have custom made schemas for the data, how can I make swagger use them. – llarsson Feb 14 '20 at 08:36
  • I think you need to implement an own ITypeMapper (https://github.com/RicoSuter/NJsonSchema/blob/master/src/NJsonSchema/Generation/TypeMappers/ITypeMapper.cs) and then update the schema from the parameter with your JSON – Rico Suter Feb 14 '20 at 17:37
  • Probably you’d add the custom schema to the schemas/components list and the type mapper returns a schema referencing the other one. – Rico Suter Feb 17 '20 at 07:50
  • Is there any further information about how to trace & troubleshoot it. Api samples just became [ { "ParametersRelative": "Unknown Type: array,null", The models in swagger bottom breaks. It's not something as stupid as I don't have examples in the hand made json schemas? – llarsson Feb 17 '20 at 09:35

0 Answers0