Which option to choose for designing this API endpoint

Let’s imagine we have an API endpoint: /cars/1 and this returns basic information about the car (id, name, description).

But we can also request GET /cars/1?info=extra and this will also return extra information about the car (price, stock). And this extra information is stored in our Database as another table, which has a One To One relationship with the Car.

If it helps, our backend is a Java Spring Boot application.

There are many ways to return the data. Would you return same objects in both requests, with the corresponding extra parameters as null in the ?info=extra request? Or would you return different objects for each one of the requests?

For me returning all the nulls when requesting the “basic” info has the advantage of using the same Class to map both requests, by only changing the @Query in the JPA Repository, making it easier to maintain.

Returning all the nulls also has the disadvantage of returning a lot of useless values that the user didn’t even requested. It also makes the API more difficult to read (someone can think that all of those values are actually null and they might not). Speaking of classes, we would have a MappedSuperClass Car and two other classes CarBasic and CarExtra, both extending Car, each one of them with the corresponding getters to create the output JSON.

Option 1:

/cars/1

{
    id: 1,
    name: "Honda Civic",
    description: "The best car of Honda"
}

/cars/1?info=extra

{
    id: 1,
    name: "Honda Civic",
    description: "The best car of Honda",
    extraInfo: {
    {
        price: 25000,
        stock: 24
    }
}

Option 2:

/cars/1

{
    id: 1,
    name: "Honda Civic",
    description: "The best car of Honda",
    extraInfo: null
}

/cars/1?info=extra

{
    id: 1,
    name: "Honda Civic",
    description: "The best car of Honda",
    extraInfo: {
    {
        price: 25000,
        stock: 24
    }
}

Option 3:

/cars/1

{
    id: 1,
    name: "Honda Civic",
    description: "The best car of Honda"
}

/cars/1?info=extra

{
    id: 1,
    name: "Honda Civic",
    description: "The best car of Honda",
    price: 25000,
    stock: 24
}

What do you think?