All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.openapiprocessor.jsonschema.schema.IdProvider6 Maven / Gradle / Ivy

There is a newer version: 2024.4
Show newest version
/*
 * Copyright 2022 https://github.com/openapi-processor/openapi-parser
 * PDX-License-Identifier: Apache-2.0
 */

package io.openapiprocessor.jsonschema.schema;

import io.openapiprocessor.jsonschema.support.Types;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.Map;

/**
 * draft-06 IdProvider
 */
public class IdProvider6 implements IdProvider {
    @Override
    public @Nullable String getId (Map properties) {
        Object ref = properties.get (Keywords.REF);
        if (Types.isString (ref))
            return null;

        Object id = properties.get (Keywords.ID);
        if (!Types.isString (id))
            return null;

        return Types.asString (id);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy