Exemple #1
0
        /// <summary>
        /// Generate a <see cref="JSchema"/> from the specified type.
        /// </summary>
        /// <param name="type">The type to generate a <see cref="JSchema"/> from.</param>
        /// <param name="rootSchemaNullable">Specify whether the generated root <see cref="JSchema"/> will be nullable.</param>
        /// <returns>A <see cref="JSchema"/> generated from the specified type.</returns>
        public virtual JSchema Generate(Type type, bool rootSchemaNullable)
        {
            ValidationUtils.ArgumentNotNull(type, nameof(type));

            LicenseHelpers.IncrementAndCheckGenerationCount();

            Required required = rootSchemaNullable ? Required.AllowNull : Required.Always;

            JSchemaGeneratorInternal generator = new JSchemaGeneratorInternal(this);

            return(generator.Generate(type, required));
        }
 internal JSchemaTypeGenerationContext(
     Type objectType,
     Required required,
     JsonProperty memberProperty,
     JsonContainerContract parentContract,
     JSchemaGeneratorInternal generatorInternal)
 {
     _objectType        = objectType;
     _required          = required;
     _memberProperty    = memberProperty;
     _parentContract    = parentContract;
     _generatorInternal = generatorInternal;
 }
Exemple #3
0
 internal JSchemaTypeGenerationContext(
     Type objectType,
     Required required,
     JsonProperty?memberProperty,
     JsonContainerContract?parentContract,
     JSchemaGeneratorInternal generatorInternal,
     string?schemaTitle,
     string?schemaDescription)
 {
     SchemaTitle        = schemaTitle;
     SchemaDescription  = schemaDescription;
     ObjectType         = objectType;
     Required           = required;
     MemberProperty     = memberProperty;
     ParentContract     = parentContract;
     _generatorInternal = generatorInternal;
 }
 public JSchemaGeneratorProxy(JSchemaGeneratorInternal generatorInternal, JSchemaGenerationProvider generationProvider)
 {
     _generator          = generatorInternal._generator;
     _generatorInternal  = generatorInternal;
     _generationProvider = generationProvider;
 }
        /// <summary>
        /// Generate a <see cref="JSchema"/> from the specified type.
        /// </summary>
        /// <param name="type">The type to generate a <see cref="JSchema"/> from.</param>
        /// <param name="rootSchemaNullable">Specify whether the generated root <see cref="JSchema"/> will be nullable.</param>
        /// <returns>A <see cref="JSchema"/> generated from the specified type.</returns>
        public JSchema Generate(Type type, bool rootSchemaNullable)
        {
            ValidationUtils.ArgumentNotNull(type, "type");

            LicenseHelpers.IncrementAndCheckGenerationCount();

            Required required = rootSchemaNullable ? Required.AllowNull : Required.Always;

            JSchemaGeneratorInternal generator = new JSchemaGeneratorInternal(this);
            return generator.Generate(type, required);
        }